Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_Utility Namespace Reference


Classes

class  VersionParser

Functions

void CP_FlipFlopFlag (SInt16 *inFlag, SInt16 inStyle)
void CP_FormatHexDigit (UInt8 inByte, char *outBuffer)
UInt8 CP_HexDigitToByte (const char *inBuffer)
char CP_HexDigitToChar (const char *inBuffer)
void CP_LongToHex (const SInt32 inLong, const bool inShowAs24Bits, char *inOutBuffer, SInt16 inOutBufferLength)
void CP_CopyMemory (const void *srcPtr, void *dstPtr, const UInt32 inBytesToCopy)
void CP_SetMemory (const void *srcPtr, const UInt32 inNumBytes, const unsigned char value)
bool CP_AreBlocksEqual (const void *inLeftBlock, const void *inRightBlock, UInt32 inLength)
void CP_FillWithGarbage (void *ptr, const UInt32 inLength)
void CP_Beep (bool simple)
bool CP_IsKeyDown (SInt16 inWhichKey)
UInt32 CP_CStrLength (const char *inString)
UInt32 CP_WStrLength (const CPUniChar *inStr)
void CP_CToPString (const char *inString, unsigned char *outString)
void CP_PToCString (const CP_String &inString, unsigned char *outString, UInt16 inMaxLength)
void CP_PToCString (const unsigned char *inString, char *outString, UInt16 outMaxStringLength)
void CP_CopyCStrings (const char *inString, char *inDestString, UInt32 maxDestStringLength=kCP_PStyleString_MaxLength)
void CP_AppendCString (const char *srcStr, char *destStr)
void CP_AppendPString (const unsigned char *srcStr, unsigned char *destStr)
CP_String CP_PToString (const unsigned char *inString)
void CP_StringToPString (const CP_String &inString, unsigned char *outString, UInt16 inMaxLength=kCP_PStyleString_MaxLength)
void CP_StringToCString (const CP_String &inString, char *outString, UInt32 inMaxLength)
CP_String CP_CStringToString (const char *inString)
CP_String CP_StringToUpper (const CP_String &inString)
CP_String CP_StringToLower (const CP_String &inString)
CP_String CP_IntToString (int inInteger)
CP_String CP_SInt16ToString (const SInt16 inSInt16)
CP_String CP_UInt16ToString (const UInt16 inUInt16)
CP_String CP_SInt32ToString (SInt32 inSInt32)
CP_String CP_UInt32ToString (const UInt32 inUInt32)
CP_String CP_SInt64ToString (const SInt64 inSInt64)
CP_String CP_UInt64ToString (const UInt64 inUInt64)
CP_String CP_FloatToString (const float inFloat)
CP_String CP_FourCharCodeToString (const FourCharCode inCode)
CP_String CP_BytesToHexString (const void *inBytes, SInt32 inNumBytes, SInt16 inWordLength=0, SInt16 inLeadingSpaces=0, SInt32 inBreakLineAfterChars=-1)
CP_String CP_VersionToString (const UInt32 inVersion)
SInt16 CP_StringToSInt16 (const CP_String &inString)
UInt16 CP_StringToUInt16 (const CP_String &inString)
SInt32 CP_StringToSInt32 (const CP_String &inStringData)
UInt32 CP_StringToUInt32 (const CP_String &inStringData)
double CP_StringToDouble (const CP_String &inString)
float CP_StringToFloat (const CP_String &inString)
FourCharCode CP_StringToFourCharCode (const CP_String &inStringData)
UInt32 CP_StringToVersion (const CP_String &inString)
DescType CP_StringToDescType (const CP_String &inStringData)
template<class Collection, class T>
bool member (const Collection &collection, const T &value)
OSStatus CP_AEGetDescData (AEDesc &inDesc, DescType &inOutTypeCode, void *inDataBuffer, ByteCount inMaximumSize, ByteCount &inOutActualSize)
void CP_RaiseSafeCastException (const char *whichCast)
void CP_FormatHexDigit (unsigned char inChar, char *outBuffer)


Function Documentation

void CP_Utility::CP_FlipFlopFlag SInt16 inFlag,
SInt16  inStyle
 

Turns inStyle bits of inFlag to their oppositate state.

Parameters:
inFlag The flag that we are applying in style to.
inStyle The state to flip the flag to.
Exceptions:
none 
Returns:
void

void CP_FormatHexDigit UInt8  inByte,
char *  outBuffer
 

UInt8 CP_Utility::CP_HexDigitToByte const char *  inBuffer  ) 
 

Return a byte from the passed in hex digit passed in a char buffer. InBuffer should point to a 2 character buffer containing the text representation of the hex digit we want to convert.

Parameters:
inBuffer Points to a buffer containing the hex digit to to convert.
Exceptions:
none 
Returns:
UInt8 The converted byte.

char CP_HexDigitToChar const char *  inBuffer  ) 
 

void CP_Utility::CP_LongToHex const SInt32  inLong,
const bool  inShowAs24Bits,
char *  inOutBuffer,
SInt16  inOutBufferLength
 

Converts the passed in SInt32 value to its hex equivalent, returning in the passed in buffer.

Parameters:
inLong The SInt32 to convert.
inShowAs24Bits If true, then the output is shown using 24 bits.
inOutBuffer Location to return the result in.
inOutBufferLength Length of the buffer to return the result.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_CopyMemory const void *  srcPtr,
void *  dstPtr,
const UInt32  inBytesToCopy
 

Copies a block of memory from srcPtr to dstPtr, copying the number of bytes specified in inBytesToCopy.

Parameters:
srcPtr Pointer to the beginning of the block to copy.
dstPtr Pointer to the beginning of the destination.
inBytesToCopy Number of bytes to copy from src to dst.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_SetMemory const void *  srcPtr,
const UInt32  inNumBytes,
const unsigned char  inValue
 

Sets a block of memory pointed to by srcptr to the value contained in inValue, repeating inNumBytes times.

For example: CP_SetMemory( buffer, 5, 'A' ); produces a buffer with AAAAA in it.

Parameters:
srcPtr Pointer to the beginning of the block to set.
inNumBytes Number of times to repeat the value.
inValue The char to place in each location.
Exceptions:
none 
Returns:
void

bool CP_Utility::CP_AreBlocksEqual const void *  inLeftBlock,
const void *  inRightBlock,
UInt32  inLength
 

Returns true if the the passed in left and right blocks of memory match starting at the first position, and going for inLength number of bytes. Passing NULL for either block is save and will cause false to be returned.

Parameters:
inLeftBlock Points to the left block.
inRightBlock Points to the right block.
inLength Number of bytes to compare.
Exceptions:
none 
Returns:
bool Returns true if both blocks are equal.

void CP_Utility::CP_FillWithGarbage void *  ptr,
const UInt32  inLength
 

Fills the passed in memory block with a garbage value. Designed for force breaks into the debugger, and used in debugging. Under Windows this will fill the block with 0xCC, otherwise 0xA3 is used.

Parameters:
ptr Points to the memory block to fill in.
inLength Number of bytes to fill.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_Beep bool  simple  ) 
 

bool CP_Utility::CP_IsKeyDown SInt16  inWhichKey  ) 
 

UInt32 CP_Utility::CP_CStrLength const char *  inString  ) 
 

Returns the length of the passed in c-style (NULL terminated) string.

Parameters:
inString The string to return the length of.
Exceptions:
none 
Returns:
SInt32 The length of the passed in string.

UInt32 CP_Utility::CP_WStrLength const CPUniChar inStr  ) 
 

Returns the length of the passed in CPUniChar Unicode style string.

Parameters:
inStr CPUniChar Unicode string to return length of.
Exceptions:
none 
Returns:
SInt32 Number of characters in passed in string.

void CP_Utility::CP_CToPString const char *  inString,
unsigned char *  outString
 

Converts the passed in c style inString to a Pascal style string, and returns the result in outString. If the source string is longer than 255 characters, only the first 255 characters are returned to keep within the 255 char string limit.

Parameters:
inString The c-style (NULL terminated) source string.
outString Pointer to a buffer to hold the returned string. This buffer should be at least 256 characters long.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_PToCString const CP_String inString,
unsigned char *  outString,
UInt16  inMaxLength
 

Converts the passed in CP_String to a p-style string.

Parameters:
inString The CP_String source string.
outString The buffer to hold the converted string.
inMaxLength Maximum number of characters to copy to output buffer.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_PToCString const unsigned char *  inString,
char *  outString,
UInt16  outMaxStringLength
 

Converts the passed in Pascal style string to a c style string in outString. If the input string is longer than the buffer maximum supplied by the parameter outMaxStringLength, then only outMaxStringLength characters are copied.

Parameters:
inString The p-style source string.
outString Pointer to a buffer to hold the returned string. This buffer should be at least outMaxStringLength characters long.
outMaxStringLength Maximum number of characters to copy to the outString buffer.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_CopyCStrings const char *  inString,
char *  inDestString,
UInt32  maxDestStringLength
 

Copy inString to inDestString limiting to maxDestStringLength if the source string is longer.

Parameters:
inString The source string to copy.
inDestString Destination loction for the string.
maxDestStringLength Maximum number of character to copy.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_AppendCString const char *  srcStr,
char *  destStr
 

Appends the passed in destStr to the end of the passed in srcStr.

Parameters:
srcStr The source string to be appended to.
destStr The destination string to be appended.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_AppendPString const unsigned char *  srcStr,
unsigned char *  destStr
 

Append one P style string to the end of another.

Parameters:
srcStr The source string to be appended to.
destStr The destination string to be appended.
Exceptions:
none 
Returns:
void

CP_String CP_Utility::CP_PToString const unsigned char *  inString  ) 
 

Converts the passed in p-style string to a CP_String.

Parameters:
inString The p-style source string.
Exceptions:
none 
Returns:
CP_String Returns the converted string.

void CP_Utility::CP_StringToPString const CP_String inString,
unsigned char *  outString,
UInt16  inMaxLength
 

Converts the passed in CP_String to a p-style string, returning the results in the passed in outString buffer.

Parameters:
inString The CP_String source string to convert.
outString Buffer to hold the results of the conversion.
inMaxLength Maximum number of characters from source string to copy to the output buffer.
Exceptions:
none 
Returns:
void

void CP_Utility::CP_StringToCString const CP_String inString,
char *  outString,
UInt32  inMaxLength
 

Converts the passed in CP_String to a c-style string, returning the results in the passed in outString buffer.

Parameters:
inString The CP_String source string to convert.
outString Buffer to hold the results of the conversion.
inMaxLength Maximum number of characters from source string to copy to the output buffer.
Exceptions:
none 
Returns:
void

CP_String CP_Utility::CP_CStringToString const char *  inString  ) 
 

Converts the passed in c-style string to a CP_String.

Parameters:
inString The c-style source string.
Exceptions:
none 
Returns:
CP_String Returns the converted string.

CP_String CP_Utility::CP_StringToUpper const CP_String inString  ) 
 

Returns a CP_String with all characters converted to upper case from the passed in string.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
CP_String Returns the converted string.

CP_String CP_Utility::CP_StringToLower const CP_String inString  ) 
 

Returns a CP_String with all characters converted to lower case from the passed in string.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
CP_String Returns the converted string.

CP_String CP_Utility::CP_IntToString int  inInteger  ) 
 

Converts the passed in integer to a CP_String.

Parameters:
inInteger The int to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_SInt16ToString const SInt16  inSInt16  ) 
 

Converts the passed in SInt16 to a CP_String.

Parameters:
inSInt16 The SInt16 to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_UInt16ToString const UInt16  inUInt16  ) 
 

Converts the passed in UInt16 to a CP_String.

Parameters:
inUInt16 The UInt16 to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_SInt32ToString SInt32  inSInt32  ) 
 

Converts the passed in SInt32 to a CP_String.

Parameters:
inSInt32 The SInt32 to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_UInt32ToString const UInt32  inUInt32  ) 
 

Converts the passed in UInt32 to a CP_String.

Parameters:
inUInt32 The UInt32 to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_SInt64ToString const SInt64  inSInt64  ) 
 

Converts the passed in SInt64 to a CP_String.

Parameters:
inSInt64 The SInt64 to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_UInt64ToString const UInt64  inUInt64  ) 
 

Converts the passed in UInt64 to a CP_String.

Parameters:
inUInt64 The UInt64 to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_FloatToString const float  inFloat  ) 
 

Converts the passed in float to a CP_String.

Parameters:
inFloat The float to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_FourCharCodeToString const FourCharCode  inCode  ) 
 

Converts the passed in FourCharCode to a CP_String.

Parameters:
inCode The FourCharCode to convert.
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_BytesToHexString const void *  inBytes,
SInt32  inNumBytes,
SInt16  inWordLength,
SInt16  inLeadingSpaces,
SInt32  inBreakLineAfterChars
 

Converts the passed in bytes into hed representation grouped in words

Parameters:
inBytes The bytes to convert
inNumBytes Number of bytes to convert
inWordLength Word length, 0 means no words
inLeadingSpaces Number of spaces to add before the bytes representation
inBreakLineAfterChars Insert a new line character after the specified characters (if -1 no new line character is inserted)
Exceptions:
none 
Returns:
CP_String The result of the conversion.

CP_String CP_Utility::CP_VersionToString const UInt32  inVersion  ) 
 

Converts the passed in version number into a string

Parameters:
inVersion The version number to convert
Exceptions:
none 
Returns:
CP_String The result of the conversion.

SInt16 CP_Utility::CP_StringToSInt16 const CP_String inString  ) 
 

Converts the passed in string and returns the result as a SInt16.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
SInt16 The result of the conversion.

UInt16 CP_Utility::CP_StringToUInt16 const CP_String inString  ) 
 

Converts the passed in string and returns the result as a UInt16.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
UInt16 The result of the conversion.

SInt32 CP_Utility::CP_StringToSInt32 const CP_String inString  ) 
 

Converts the passed in string and returns the result as a SInt32.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
SInt32 The result of the conversion.

UInt32 CP_Utility::CP_StringToUInt32 const CP_String inString  ) 
 

Converts the passed in string and returns the result as a UInt32.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
UInt32 The result of the conversion.

double CP_Utility::CP_StringToDouble const CP_String inString  ) 
 

Converts the passed in string and returns the result as a double.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
double The result of the conversion.

float CP_Utility::CP_StringToFloat const CP_String inString  ) 
 

Converts the passed in string and returns the result as a float.

Parameters:
inString The string to convert.
Exceptions:
none 
Returns:
float The result of the conversion.

FourCharCode CP_Utility::CP_StringToFourCharCode const CP_String inStringData  ) 
 

Converts the passed in CP_String to a FourCharCode. If the passed in string contains less data then a FourCharCode can hold, then the result is returned in the least significant bytes.

Example: 'AB' becomes ' AB'

Parameters:
inStringData The string to convert.
Exceptions:
none 
Returns:
FourCharCode The converted string data.

UInt32 CP_Utility::CP_StringToVersion const CP_String inString  ) 
 

DescType CP_Utility::CP_StringToDescType const CP_String inStringData  ) 
 

Converts the passed in CP_String to a DescType.

Parameters:
inStringData The string to convert.
Exceptions:
none 
Returns:
DescType The converted string data.

template<class Collection, class T>
bool CP_Utility::member const Collection &  collection,
const T &  value
 

OSStatus CP_Utility::CP_AEGetDescData AEDesc &  inDesc,
DescType &  inOutTypeCode,
void *  inDataBuffer,
ByteCount  inMaximumSize,
ByteCount &  inOutActualSize
 

Returns the data from the passed in AEDesc.

Parameters:
inDesc The AEDesc of the data.
inOutTypeCode The DescType code of the data.
inDataBuffer Buffer to return the result in.
inMaximumSize Maximum size of the result.
inOutActualSize The actual size of the returned data.
Exceptions:
none 
Returns:
OSStatus Result of the conversion.

void CP_Utility::CP_RaiseSafeCastException const char *  whichCast  ) 
 

void CP_FormatHexDigit unsigned char  inChar,
char *  outBuffer
 

Format our inChar into its hex equivalent. Note: outBuffer should point to a buffer 2 characters wide.

Parameters:
inChar The character we are going for format.
outBuffer Points to a buffer where the result will be returned. This buffer needs to be able to at least 2 characters.
Exceptions:
none 
Returns:
void


Generated on Sat Sep 17 20:02:40 2005 for CPLAT by  doxygen 1.4.0