![]() |
Humble Framework for SkyOS |
Portable alias for the "memory comparison" RTL function (memcmp)
STR_* macros text string pointers for validity. These wrap the "safe" versions of the different RTL functions that check for NULL pointers or respect a caller-supplied maximum value.
Counts the number of times a character occurs in a string
Data Structures | |
| class | HObj |
| All Humble Framework classes are derived from this object. More... | |
| class | HObjNoCopy |
| Subclass of HObj that prevents and object from being copied. More... | |
| class | HID |
| Mix-in class that adds an "ID" to any class. More... | |
| class | HError |
| Stores error information. More... | |
| class | HMemory |
| The HMemory class manages a dynamic memory buffer. More... | |
| class | HMem< BUFFER_SIZE > |
| Manages a small (<4KB) buffer by pre-allocating the memory. More... | |
| class | HPtr< T > |
| HPtr template class. More... | |
| class | HString |
| Dynamically allocated string class with reference counting. More... | |
| class | HStr< MAX_LEN > |
| Manages small (<4KB) strings by pre-allocating the buffer. More... | |
| class | HClass |
| Brief description of the class. More... | |
Defines | |
| #define | TEXT(p) ((unsigned char *)(p)) |
| #define | MEM_CMP(x, y, n) Humble::safe_memcmp((x),(y),(n)) |
| #define | MEM_COPY(d, s, n) Humble::safe_memcpy((d),(s),(n)) |
| Portable alias for the "memory copy" RTL function (memcpy). | |
| #define | MEM_FILL(d, c, n) Humble::safe_memset((d),(c),(n)) |
| Portable alias for the "memory set" RTL function (memset). | |
| #define | MEM_MOVE(d, s, n) Humble::safe_memmove((d),(s),(n)) |
| Portable alias for the "memory move" RTL function (memmove). | |
| #define | MEM_ZERO(d, n) Humble::safe_memset((d),0x00,(n)) |
| Portable alias for the "memory zero" RTL function. | |
| #define | STR_COUNT(p, c) Humble::safe_strcount((p),(c)) |
| #define | STR_EMPTY(p) (NULL_PTR(p) || *(p) == '\0') |
| Evaluates to true if a pointer is invalid, or references a zero-length string. | |
| #define | STR_SAFE(p) (GOOD_PTR(p) ? (p) : kStrEmpty) |
| Returns a string, or an empty string ("") if the string pointer is invalid. | |
| #define | STR_VALID(p) (GOOD_PTR(p) && *(p) != '\0') |
| Evaluates to true if a string is valid and non-empty (opposite to STR_EMPTY). | |
| #define | STR_CAT(s, d, n) Humble::safe_strncat((s),(d),(n)) |
| Substitute for the "string character search" (strncat) RTL function. | |
| #define | STR_CHR(s, c) Humble::safe_strchr((s),(c)) |
| Substitute for the "string character search" (strchr) RTL function. | |
| #define | STR_CMP(a, b) Humble::safe_strcmp((a),(b)) |
| Substitue for the "string compare" (strcmp) RTL function. | |
| #define | STR_ICMP(a, b) Humble::safe_strcmpi((a),(b)) |
| Substitue for the "string case insensitive compare" (stricmp) RTL function. | |
| #define | STR_NCMP(a, b, n) Humble::safe_strcmpn((a),(b),(n)) |
| Substitue for the "string case fixed length compare" (strncmp) RTL function. | |
| #define | STR_WCMP(a, b) Humble::safe_strcmpw((a),(b)) |
| string case wildcard compare" function | |
| #define | STR_CPY(s, d) Humble::safe_strncpy((s),(d)) |
| Substitue for the "string copy" (strnpy) RTL function. | |
| #define | STR_NCPY(s, d, n) Humble::safe_strncpy((s),(d),(n)) |
| #define | STR_LEN(s) Humble::safe_strlen(s) |
| Substitue for the "string length" (strlen) RTL function. | |
| #define | STR_NLEN(s, u) Humble::safe_strlen((s),(u)) |
| #define | STR_LWR(s) Humble::safe_strlwr(s) |
| Substitue for the "string lower" (strlwr) RTL function. | |
| #define | STR_RCHR(s, c) Humble::safe_strrchr((s),(c)) |
| Substitute for the "string reverse character search" (strrchr) RTL function. | |
| #define | STR_REV(s) Humble::safe_strrev(s) |
| Substitute for the "string reverse" (strrev) RTL function. | |
| #define | STR_SPRINTF Humble::safe_sprintf |
| Portable alias for the "string formatting" RTL function (sprintf). | |
| #define | STR_STR(s, a) Humble::safe_strstr((s),(a)) |
| Substitute for the "string substring search" (strstr) RTL function. | |
| #define | STR_TO_INT(s) Humble::safe_strtoi(s) |
| Substitute for the "string to integer" (strtoi) RTL function. | |
| #define | STR_UPR(s) Humble::safe_strupr(s) |
| Substitue for the "string upper" (strupr) RTL function. | |
| #define | STR_VSPRINTF Humble::safe_vsprintf |
| Portable alias for the vsprintf() RTL function. | |
| #define | DECLARE_HUMBLE_APP(x) |
| Declares the global main() function. | |
Typedefs | |
| typedef char | Text |
| < Portable alias for a single character (char) Portable alias for a character (string) pointer (char *) | |
| typedef Text * | TextPtr |
| Portable alias for a pointer to a constant string (char const *). | |
| typedef Text const * | StringPtr |
| typedef signed char | int8 |
| < Portable alias for a signed 8-bit value Portable alias for an unsigned 8-bit value | |
| typedef unsigned char | uint8 |
| typedef short | int16 |
| < Portable alias for a signed 15-bit value Portable alias for an unsigned 15-bit value | |
| typedef unsigned short | uint16 |
| typedef long | int32 |
| < Portable alias for a signed 32-bit value Portable alias for an unsigned 32-bit value | |
| typedef unsigned long | uint32 |
| typedef void * | Ptr |
| < Portable alias for a void pointer (void *) Portable alias for a pointer to constant byte data (const unsigned char *) | |
| typedef void const * | PtrConst |
| Portable alias for a pointer to byte data (unsigned char *). | |
| typedef uint8 * | PtrData |
| Portable alias for a pointer to byte data (unsigned char *). | |
| typedef uint8 const * | PtrDataConst |
| Force a string as changeable to avoid compiler warnings. | |
| typedef HStr< 255 > | HStrTmp |
| Generic string class. | |
Enumerations | |
| enum | ErrCode { ERR_ASSERT = -1, NO_ERROR = 0, ERR_API_ERROR, ERR_BAD_PARAMETER, ERR_BAD_WINDOW, ERR_BUFFER_OVERFLOW, ERR_BUFFER_UNDERFLOW, ERR_BUY_MORE_RAM, ERR_CRC_FAILURE, ERR_DATA_INVALID, ERR_DIV_ZERO, ERR_DUPLICATE, ERR_FILE_INVALID, ERR_FILE_DELETE, ERR_FILE_OPEN, ERR_FILE_READ, ERR_FILE_WRITE, ERR_MAX_CAPACITY, ERR_NOT_FOUND, ERR_NOT_IMPLEMENTED, ERR_NOT_INITIALIZED, ERR_NULL_PTR, ERR_OUT_OF_RANGE, ERR_STL_EXCEPTION, ERR_MYSTERY } |
| An enumerated list of error codes. More... | |
Functions | |
| int32 | Humble::safe_memcmp (PtrConst, PtrConst, uint32) |
| Replacement for the "memory comparison" (memcmp) RTL function. | |
| Ptr | Humble::safe_memcpy (Ptr, PtrConst, uint32) |
| Replacement for the "memory copy" (memcpy) RTL function. | |
| Ptr | Humble::safe_memmove (Ptr, PtrConst, uint32) |
| Replacement for the "memory move" (memmove) RTL function. | |
| Ptr | Humble::safe_memset (Ptr, uint8, uint32) |
| Replacement for the "memory set" (memset) RTL function. | |
| StringPtr | Humble::safe_strchr (StringPtr, Text) |
| Replacement for the "string character" (strchr) RTL function. | |
| int32 | Humble::safe_strcmp (StringPtr, StringPtr) |
| Replacement for the "string comparison" (strcmp) RTL function. | |
| int32 | Humble::safe_strcmpi (StringPtr, StringPtr) |
| Replacement for the "string comparison" (stricmp) RTL function. | |
| bool | Humble::safe_strcmpw (StringPtr, StringPtr) |
| String comparison function with wildcards. | |
| TextPtr | Humble::safe_strncat (TextPtr, StringPtr, int32) |
| Replacement for the "string concatenate" (strncat) RTL function. | |
| int32 | Humble::safe_strcount (StringPtr, Text) |
| Counts the number of times a character is found in a string. | |
| int | Humble::safe_strlen (StringPtr, int32 nMaxLen=INT32_MAX) |
| Replacement for the "string length" (strlen) RTL function. | |
| TextPtr | Humble::safe_strlwr (TextPtr) |
| Replacement for the "string lower" (strlwr) RTL function. | |
| StringPtr | Humble::safe_strrchr (StringPtr, Text) |
| Replacement for the "string reverse character" (strrchr) RTL function. | |
| TextPtr | Humble::safe_strrev (TextPtr) |
| Replacement for the "string reverse" (strrev) RTL function. | |
| StringPtr | Humble::safe_strstr (StringPtr, StringPtr) |
| Replacement for the "string substring search" (strstr) RTL function. | |
| int32 | Humble::safe_strtoi (StringPtr) |
| Converts a string to an integer. | |
| TextPtr | Humble::safe_strupr (TextPtr) |
| Replacement for the "string upper" (strupr) RTL function. | |
| int32 | Humble::safe_vsprintf (TextPtr, int32, StringPtr, va_list) |
| Replacement for the vsprintf() RTL function. | |
| int32 | Humble::safe_sprintf (TextPtr, int32, StringPtr,...) |
| Replacement for the sprintf() RTL function. | |
Variables | |
| const int8 | INT8_MAX = SCHAR_MAX |
| maximum value for int8 | |
| const int8 | INT8_MIN = SCHAR_MIN |
| minimum value for int8 | |
| const uint8 | UINT8_MAX = UCHAR_MAX |
| maximum value for uint8 | |
| const int16 | INT16_MAX = SHRT_MAX |
| maximum value for int16 | |
| const int16 | INT16_MIN = SHRT_MIN |
| minimum value for int16 | |
| const uint16 | UINT16_MAX = USHRT_MAX |
| maximum value for uint16 | |
| const int32 | INT32_MAX = LONG_MAX |
| maximum value for int32 | |
| const int32 | INT32_MIN = LONG_MIN |
| minimum value for int32 | |
| const uint32 | UINT32_MAX = ULONG_MAX |
| maximum value for uint32 | |
|
|
Value: x theApp; \
int main(int argc, char * argv[]) \
{ return theApp.Main(argc, argv); }
|
|
|
The HStrTmp class is an instance of the HStr class, predefined to a maximum length of 255 bytes. It is intended for generic usage. |
|
|
Fatal error codes which (eventually) should be translated into human- readable strings. By convention, debugging errors are negative, while run-time errors are positve.
|
|
||||||||||||||||
|
This method is identical to memcmp(), but is also guaranteed to correctly handle NULL pointers. This method is wrapped by the MEM_CMP macro.
Definition at line 223 of file Humble.cpp. |
|
||||||||||||||||
|
This method is identical to memcpy(), but is also guaranteed to correctly handle NULL parameters. It also checks for overlapping copies and calls memmove() when applicable. This method is wrapped by the MEM_COPY macro.
Definition at line 246 of file Humble.cpp. |
|
||||||||||||||||
|
This method is identical to memmove(), but is also guaranteed to correctly handle NULL parameters. This method is wrapped by the MEM_MOVE macro.
Definition at line 273 of file Humble.cpp. |
|
||||||||||||||||
|
This method is identical to memset(), but is also guaranteed to correctly handle invalid parameters. This method is wrapped by the MEM_FILL macro.
Definition at line 294 of file Humble.cpp. |
|
||||||||||||
|
This method is a wrapper around strchr(), but also correctly handles a NULL string by returning a NULL result. This method is wrapped by the STR_CHR macro.
Definition at line 315 of file Humble.cpp. |
|
||||||||||||
|
This method is a wrapper around strcmp(), but also correctly handles NULL parameters. This method is wrapped by the STR_CMP macro.
Definition at line 330 of file Humble.cpp. |
|
||||||||||||
|
This method is a wrapper around stricmp(), but also correctly handles NULL parameters. This method is wrapped by the STR_ICMP macro.
Definition at line 350 of file Humble.cpp. |
|
||||||||||||
|
This method is identical to strncmp(), but also correctly handles NULL parameters. It also recognizes the '?' and '*' wildcard operators. This method is wrapped by the STR_CMPW macro.
Definition at line 404 of file Humble.cpp. |
|
||||||||||||||||
|
This method is identical to strncat(), but is also guaranteed to correctly handle NULL parameters. This method is wrapped by the STR_CAT macro.
Definition at line 483 of file Humble.cpp. |
|
||||||||||||
|
Definition at line 538 of file Humble.cpp. |
|
||||||||||||
|
This method is identical to strlen(), but is also guaranteed to correctly handle a NULL string by returning a zero result. It also sanity checks the counter to ensure that it doesn't roll over (and go negative). This method is wrapped by the STR_LEN macro.
Definition at line 563 of file Humble.cpp. |
|
|
This method is identical to strlwr(), but is also guaranteed to correctly handle a NULL string by returning a NULL result. This method is wrapped by the STR_LWR macro.
Definition at line 585 of file Humble.cpp. |
|
||||||||||||
|
This method is identical to strrchr(), but is also guaranteed to correctly handle a NULL string by returning a NULL result. This method is wrapped by the STR_RCHR macro.
Definition at line 606 of file Humble.cpp. |
|
|
This method is identical to strrev(), but is also guaranteed to correctly handle a NULL string by returning a NULL result. This method is wrapped by the STR_REV macro.
Definition at line 629 of file Humble.cpp. |
|
||||||||||||
|
This method is identical to strstr(), but is also guaranteed to correctly handle NULL parameters by returning a NULL result. This method is wrapped by the STR_STR macro.
Definition at line 666 of file Humble.cpp. |
|
|
Definition at line 690 of file Humble.cpp. |
|
|
This method is identical to strupr(), but is also guaranteed to correctly handle a NULL string by returning a NULL result. This method is wrapped by the STR_UPR macro.
Definition at line 731 of file Humble.cpp. |
|
||||||||||||||||||||
|
This method is identical to vsprintf(), but is also guaranteed to correctly handle NULL parameters by returning a NULL result. This method is wrapped by the STR_VSPRINTF macro.
Definition at line 754 of file Humble.cpp. |
|
||||||||||||||||||||
|
This method is identical to sprintf(), but is also guaranteed to correctly handle NULL parameters by returning a NULL result. This method is wrapped by the STR_SPRINTF macro.
Definition at line 793 of file Humble.cpp. |
2006.01.09-16:37