Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

util.h File Reference

Go to the source code of this file.

Functions

int min (int a, int b)
int max (int a, int b)
void fexpand (char *)
char hotKey (const char *s)
ushort ctrlToArrow (ushort keyCode)
char getAltChar (ushort keyCode)
ushort getAltCode (char ch)
char getCtrlChar (ushort keyCode)
ushort getCtrlCode (uchar ch)
ushort historyCount (uchar id)
const char* historyStr (uchar id, int index)
void historyAdd (uchar id, const char *str)
int cstrlen (const char *s)
void* message (TView *receiver, ushort what, ushort command, void *infoPtr)
Boolean lowMemory ()
char* newStr (const char *s)
Boolean isDir (const char *str)
Boolean pathValid (const char *path)
Boolean validFileName (const char *fileName)
void getCurDir (char *dir)
Boolean isWild (const char *f)
void expandPath (const char *path, char *dir, char *file)
long int filelength (int fd)


Detailed Description

util.h

Definition in file util.h.


Function Documentation

int cstrlen ( const char * s )
 

Returns the length of string `s', where `s' is a control string using tilde characters (`~') to designate hot keys. The tildes are excluded from the length of the string, as they will not appear on the screen. For example, given the argument "~B~roccoli", cstrlen() returns 8.

ushort ctrlToArrow ( ushort keyCode )
 

Converts a WordStar-compatible control key code to the corresponding cursor key code. If the low byte of `keyCode' matches one of the following key values, the result is the corresponding constant. Otherwise, `keyCode' is returned unchanged.

 Keystroke Lo(keyCode) Result

 Ctrl-A    0x01        kbHome
 Ctrl-C    0x03        kbPgDn
 Ctrl-D    0x04        kbRight
 Ctrl-E    0x05        kbUp
 Ctrl-F    0x06        kbEnd
 Ctrl-G    0x07        kbDel
 Ctrl-H    0x08        kbBack
 Ctrl-R    0x12        kbPgUp
 Ctrl-S    0x13        kbLeft
 Ctrl-V    0x16        kbIns
 Ctrl-X    0x18        kbDown
 

void expandPath ( const char * path,
char * dir,
char * file )
 

Undocumented.

void fexpand ( char * )
 

Undocumented.

long int filelength ( int fd )
 

Undocumented.

char getAltChar ( ushort keyCode )
 

Returns the character ch for which Alt-ch produces the 2-byte scan code given by the argument `keyCode'. This function gives the reverse mapping to getAltCode().

See also:
getAltCode

ushort getAltCode ( char ch )
 

Returns the 2-byte scan code (key code) corresponding to Alt-ch. This function gives the reverse mapping to getAltChar().

See also:
getAltChar

char getCtrlChar ( ushort keyCode )
 

Returns the character, ch, for which Ctrl+ch produces the 2-byte scan code given by the argument `keyCode'. Gives the reverse mapping to getCtrlCode().

See also:
getCtrlCode

ushort getCtrlCode ( uchar ch )
 

Returns the 2-byte scan code (keycode) corresponding to Ctrl+ch, where `ch' is the argument. This function gives the reverse mapping to getCtrlChar().

See also:
getCtrlChar

void getCurDir ( char * dir )
 

Undocumented.

void historyAdd ( uchar id,
const char * str )
 

Adds the string `str' to the history list indicated by `id'.

See also:
THistInit , THistory , THistoryViewer , THistoryWindow , historyCount , historyStr

ushort historyCount ( uchar id )
 

Returns the number of strings in the history list corresponding to ID number `id'.

See also:
THistInit , THistory , THistoryViewer , THistoryWindow , historyAdd , historyStr

const char * historyStr ( uchar id,
int index )
 

Returns the index'th string in the history list corresponding to ID number `id'.

See also:
THistInit , THistory , THistoryViewer , THistoryWindow , historyAdd , historyCount

char hotKey ( const char * s )
 

Undocumented.

Boolean isDir ( const char * str )
 

Undocumented.

Boolean isWild ( const char * f )
 

Undocumented.

Boolean lowMemory ( )
 

Calls TVMemMgr::safetyPoolExhausted() to check the state of the safety pool.

See also:
TVMemMgr::safetyPoolExhausted

int max ( int a,
int b ) [inline]
 

Undocumented.

Definition at line 30 of file util.h.

Referenced by TRect::Union(), and TRect::intersect().

void * message ( TView * receiver,
ushort what,
ushort command,
void * infoPtr )
 

message() sets up a command event with the arguments `event', `command', and `infoPtr', and then, if possible, invokes receiver->handleEvent() to handle this event.

See also:
TView::handleEvent

message() returns 0 if receiver is 0, or if the event is not handled successfully. If the event is handled successfully (that is, if TView::handleEvent() returns event.what as evNothing), the function returns event.infoPtr.

The latter can be used to determine which view actually handled the dispatched event. The event argument is usually set to evBroadcast.

For example, the default TScrollBar::scrollDraw() sends the following message to the scroll bar's owner:

 message(owner, evBroadcast, cmScrollBarChanged, this);
 

The above message ensures that the appropriate views are redrawn whenever the scroll bar's value changes.

int min ( int a,
int b ) [inline]
 

Undocumented.

Definition at line 22 of file util.h.

Referenced by TRect::Union(), and TRect::intersect().

char * newStr ( const char * s )
 

Dynamic string creation. If `s' is a null pointer, newStr() returns a 0 pointer; otherwise, strlen(s)+ 1 bytes are allocated, containing a copy of `s' (with a terminating '\0'), and a pointer to the first byte is returned.

You can use delete to dispose of such strings.

Referenced by TSItem::TSItem().

Boolean pathValid ( const char * path )
 

Undocumented.

Boolean validFileName ( const char * fileName )
 

Undocumented.


Generated at Sat Sep 22 20:19:17 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001