Rudiments
|
Static Public Member Functions | |
static void * | duplicate (const void *src, size_t size) |
static void * | copy (void *dest, const void *src, size_t size) |
static void * | copyWithOverlap (void *dest, const void *src, size_t size) |
static void * | copyUntil (void *dest, const void *src, unsigned char character, size_t size) |
static void * | copySwapBytes (void *dest, const void *src, size_t size) |
static void * | set (void *dest, unsigned char character, size_t size) |
static void * | zero (void *dest, size_t size) |
static int32_t | compare (const void *s1, const void *s2, size_t size) |
static void * | findFirst (void *haystack, unsigned char needle, size_t size) |
static void * | findLast (void *haystack, unsigned char needle, size_t size) |
static void * | findFirst (void *haystack, size_t haystacksize, const void *needle, size_t needleize) |
static void * | findLast (void *haystack, size_t haystacksize, const void *needle, size_t needleize) |
static const void * | findFirst (const void *haystack, unsigned char needle, size_t size) |
static const void * | findLast (const void *haystack, unsigned char needle, size_t size) |
static const void * | findFirst (const void *haystack, size_t haystacksize, const void *needle, size_t needleize) |
static const void * | findLast (const void *haystack, size_t haystacksize, const void *needle, size_t needleize) |
The rawbuffer class provides methods for operating on raw memory buffers.
Unlike the functions in sys/string.h, these methods are NULL safe. If any of the pointer arguments are NULL, your application will not crash.
static int32_t rawbuffer::compare | ( | const void * | s1, |
const void * | s2, | ||
size_t | size | ||
) | [static] |
Returns an integer less than, equal to or greater than 0 if "size" bytes of "s1" are less than, equal to or greater than "size" bytes of "s2".
static void* rawbuffer::copy | ( | void * | dest, |
const void * | src, | ||
size_t | size | ||
) | [static] |
Copies "size" bytes from "src" into "dest". "src" and "dest" may NOT overlap. Returns a pointer to "dest".
static void* rawbuffer::copySwapBytes | ( | void * | dest, |
const void * | src, | ||
size_t | size | ||
) | [static] |
Copies "size" bytes from "src" into "dest" while swapping byte order. Useful for exchanging data between big and little endian machines. "src" and "dest" may NOT overlap. Returns a pointer to "dest".
static void* rawbuffer::copyUntil | ( | void * | dest, |
const void * | src, | ||
unsigned char | character, | ||
size_t | size | ||
) | [static] |
Copies bytes from "src" into "dest" until "character" is encountered in "src" or "size" bytes have been copied. "src" and "dest" may NOT overlap. Returns a pointer to "dest".
static void* rawbuffer::copyWithOverlap | ( | void * | dest, |
const void * | src, | ||
size_t | size | ||
) | [static] |
Copies "size" bytes from "src" to "dest". "src" and "dest" may overlap. Returns a pointer to "dest".
static void* rawbuffer::duplicate | ( | const void * | src, |
size_t | size | ||
) | [static] |
Allocates a buffer of "size" bytes, copies "size" bytes of "src" into it and returns the buffer.
static void* rawbuffer::findFirst | ( | void * | haystack, |
unsigned char | needle, | ||
size_t | size | ||
) | [static] |
Returns a pointer to the first occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static void* rawbuffer::findFirst | ( | void * | haystack, |
size_t | haystacksize, | ||
const void * | needle, | ||
size_t | needleize | ||
) | [static] |
Returns a pointer to the first occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static const void* rawbuffer::findFirst | ( | const void * | haystack, |
unsigned char | needle, | ||
size_t | size | ||
) | [static] |
Returns a pointer to the first occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static const void* rawbuffer::findFirst | ( | const void * | haystack, |
size_t | haystacksize, | ||
const void * | needle, | ||
size_t | needleize | ||
) | [static] |
Returns a pointer to the first occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static void* rawbuffer::findLast | ( | void * | haystack, |
unsigned char | needle, | ||
size_t | size | ||
) | [static] |
Returns a pointer to the last occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static const void* rawbuffer::findLast | ( | const void * | haystack, |
size_t | haystacksize, | ||
const void * | needle, | ||
size_t | needleize | ||
) | [static] |
Returns a pointer to the last occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static const void* rawbuffer::findLast | ( | const void * | haystack, |
unsigned char | needle, | ||
size_t | size | ||
) | [static] |
Returns a pointer to the last occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static void* rawbuffer::findLast | ( | void * | haystack, |
size_t | haystacksize, | ||
const void * | needle, | ||
size_t | needleize | ||
) | [static] |
Returns a pointer to the last occurrance of "needle" in the first "size" bytes of "haystack". Returns NULL if no match is found.
static void* rawbuffer::set | ( | void * | dest, |
unsigned char | character, | ||
size_t | size | ||
) | [static] |
Sets "size" bytes of "dest" to "character". Returns a pointer to "dest".
static void* rawbuffer::zero | ( | void * | dest, |
size_t | size | ||
) | [static] |
Sets "size" bytes of "dest" to NULL. Returns a pointer to "dest".