![]() |
Humble Framework for SkyOS |
Definition in file HAL.h.
Go to the source code of this file.
Namespaces | |
| namespace | Humble |
Defines | |
| #define | TEXT(p) ((unsigned char *)(p)) |
| #define | NOTHING ((void)0) |
| #define | KB(n) ((n) * 1024) |
| #define | MB(n) (KB(n) * 1024) |
| #define | GB(n) (MB(n) * 1024) |
| #define | ARRAY_DIM(x) (sizeof(x)/sizeof((x)[0])) |
| Computes the number of elements in an array. | |
| #define | GOOD_HND(h) (NULL != HANDLE(h)) |
| Evaluates to true if a handle is valid. | |
| #define | NULL_HND(h) (NULL == HANDLE(h)) |
| Evalutes to true if a handle is NOT valid. | |
| #define | GOOD_PTR(p) (NULL != Ptr(p)) |
| Evaluates to true if a pointer is valid. | |
| #define | NULL_PTR(p) (NULL == Ptr(p)) |
| Evaluates to true if a pointer is NOT valid. | |
| #define | MAKE_PTR(c, p, n) reinterpret_cast<c>(size_t(p)+size_t(n)) |
| #define | GCC_ONLY(x) |
| #define | TEST_ONLY(x) |
| #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. | |
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. | |
Functions | |
| template<class T> | |
| T | max (const T &x, const T &y) |
| Returns the greater of two values. | |
| template<class T> | |
| T | min (const T &x, const T &y) |
| Returns the lesser of two values. | |
| template<class T> | |
| void | minmax (const T *array, uint32 uCount, T &minVal, T &maxVal) |
| Find the min/max of an array. | |
| template<class T> | |
| void | swap (T &x, T &y) |
| A generic swap() function. | |
| template<class T> | |
| void | swapInPlace (T &x, T &y) |
| A generic swap() function that does not create a temporary object. | |
| void | PopUpAlert (StringPtr, StringPtr pstrBase=NULL,...) |
| Displays the prompt dialog and waits for the user to acknowledge it. | |
| void | PopUpInfo (StringPtr, StringPtr pstrBase=NULL,...) |
| Displays the prompt dialog and waits for the user to acknowledge it. | |
| int32 | PopUpOKCancel (StringPtr, StringPtr pstrBase=NULL,...) |
| Displays the prompt dialog and waits for the user to acknowledge it. | |
| int32 | PopUpYesNo (StringPtr, StringPtr pstrBase=NULL,...) |
| Displays the prompt dialog and waits for the user to acknowledge it. | |
| int32 | safe_memcmp (PtrConst, PtrConst, uint32) |
| Replacement for the "memory comparison" (memcmp) RTL function. | |
| Ptr | safe_memcpy (Ptr, PtrConst, uint32) |
| Replacement for the "memory copy" (memcpy) RTL function. | |
| Ptr | safe_memmove (Ptr, PtrConst, uint32) |
| Replacement for the "memory move" (memmove) RTL function. | |
| Ptr | safe_memset (Ptr, uint8, uint32) |
| Replacement for the "memory set" (memset) RTL function. | |
| StringPtr | safe_strchr (StringPtr, Text) |
| Replacement for the "string character" (strchr) RTL function. | |
| int32 | safe_strcmp (StringPtr, StringPtr) |
| Replacement for the "string comparison" (strcmp) RTL function. | |
| int32 | safe_strcmpi (StringPtr, StringPtr) |
| Replacement for the "string comparison" (stricmp) RTL function. | |
| int32 | safe_strcmpn (StringPtr, StringPtr, uint32) |
| Replacement for the "string comparison" (strncmp) RTL function. | |
| bool | safe_strcmpw (StringPtr, StringPtr) |
| String comparison function with wildcards. | |
| TextPtr | safe_strncat (TextPtr, StringPtr, int32) |
| Replacement for the "string concatenate" (strncat) RTL function. | |
| TextPtr | safe_strncpy (TextPtr, StringPtr, int32 nMaxLen=INT32_MAX) |
| Replacement for the "string copy" (strncpy) RTL function. | |
| int32 | safe_strcount (StringPtr, Text) |
| Counts the number of times a character is found in a string. | |
| int | safe_strlen (StringPtr, int32 nMaxLen=INT32_MAX) |
| Replacement for the "string length" (strlen) RTL function. | |
| TextPtr | safe_strlwr (TextPtr) |
| Replacement for the "string lower" (strlwr) RTL function. | |
| StringPtr | safe_strrchr (StringPtr, Text) |
| Replacement for the "string reverse character" (strrchr) RTL function. | |
| TextPtr | safe_strrev (TextPtr) |
| Replacement for the "string reverse" (strrev) RTL function. | |
| StringPtr | safe_strstr (StringPtr, StringPtr) |
| Replacement for the "string substring search" (strstr) RTL function. | |
| int32 | safe_strtoi (StringPtr) |
| Converts a string to an integer. | |
| TextPtr | safe_strupr (TextPtr) |
| Replacement for the "string upper" (strupr) RTL function. | |
| int32 | safe_vsprintf (TextPtr, int32, StringPtr, va_list) |
| Replacement for the vsprintf() RTL function. | |
| int32 | 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 | |
| const StringPtr | kStrEmpty = "" |
| An empty string. | |
| const StringPtr | kStrEOL = "\n" |
| An End of Line string. | |
| const Text | kDirSeparator = '/' |
| The character used to separate directories in a file path. | |
| const uint32 | MAX_PATH = 1023 |
| Maximum length of a fully-qualified file specifier (4096 according to API?). | |
| const HRESULT | S_FAILED = ~S_OK |
| const uint32 | BAD_INDEX = std::string::npos |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
This procedure computes minimum min and maximum max of n numbers using only (3n / 2) - 2 comparisons.
|
|
||||||||||||||||
|
This function will swap the values of two variable, providing they are identical data types. (Note: Classes declared with the HObjNoCopy mix- in class cannot be "swapped". This is by design.)
|
|
||||||||||||||||
|
This function will swap the values of two variable, providing they are identical data types. The items are swapped "in line" using XOR operations to avoid the need to create a temporary object. This is useful for data types that are very large.
|
|
||||||||||||||||
|
Allows printf-style arguments to be passed in.
Definition at line 815 of file Humble.cpp. |
|
||||||||||||||||
|
Allows printf-style arguments to be passed in.
Definition at line 845 of file Humble.cpp. |
|
||||||||||||||||
|
Allows printf-style arguments to be passed in.
Definition at line 875 of file Humble.cpp. |
|
||||||||||||||||
|
Allows printf-style arguments to be passed in.
Definition at line 910 of file Humble.cpp. |
|
||||||||||||||||
|
This method is identical to strncmp(), but is also guaranteed to correctly handle NULL parameters. This method is wrapped by the STR_CMPN macro.
Definition at line 370 of file Humble.cpp. |
|
||||||||||||||||
|
This method is identical to strncpy(), but is also guaranteed to correctly handle NULL parameters. This method is wrapped by the STR_CPY and STR_NCPY macros.
Definition at line 515 of file Humble.cpp. |