hex dump More...


Typedefs | |
| typedef typedefCGUL_BEGIN_C struct cgul_hex_dump * | cgul_hex_dump_t |
Functions | |
| CGUL_EXPORT cgul_hex_dump_t | cgul_hex_dump__new (cgul_exception_t *cex) |
| CGUL_EXPORT void | cgul_hex_dump__delete (cgul_hex_dump_t hd) |
| CGUL_EXPORT void | cgul_hex_dump__append (cgul_exception_t *cex, cgul_hex_dump_t hd, const void *buffer, size_t buffer_length) |
| CGUL_EXPORT cgul_string_t | cgul_hex_dump__get_value (cgul_exception_t *cex, cgul_hex_dump_t hd) |
| CGUL_EXPORT void | cgul_hex_dump__clear (cgul_exception_t *cex, cgul_hex_dump_t hd, int reset_byte_count) |
Create a hex dump of arbitrary binary data.
| typedef typedefCGUL_BEGIN_C struct cgul_hex_dump* cgul_hex_dump_t |
| CGUL_EXPORT cgul_hex_dump_t cgul_hex_dump__new | ( | cgul_exception_t * | cex | ) |
Create a new cgul_hex_dump object. The caller is responsible for freeing the object by calling cgul_hex_dump__delete(). If memory cannot be allocated, NULL is returned and an exception is thrown.
| [in,out] | cex | c-style exception |
cgul_hex_dump instance | CGUL_EXPORT void cgul_hex_dump__delete | ( | cgul_hex_dump_t | hd | ) |
This method frees all internally allocated memory. Do not try to use hd after calling this method.
| [in] | hd | cgul_hex_dump instance |
| CGUL_EXPORT void cgul_hex_dump__append | ( | cgul_exception_t * | cex, |
| cgul_hex_dump_t | hd, | ||
| const void * | buffer, | ||
| size_t | buffer_length | ||
| ) |
Bytes from buffer to buffer + buffer_length will be append to the conversion. You can call this function as often as you like. For efficiency, a new cgul_string is internally allocated for each call you make to cgul_hex_dump__append(). The new cgul_string is then put on a linked list. When you call cgul_hex_dump__get_value(), all the cgul_string objects on the list are concatenated. If this function fails to allocate memory, an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | hd | cgul_hex_dump instance |
| [in] | buffer | buffer |
| [in] | buffer_length | buffer length |
| CGUL_EXPORT cgul_string_t cgul_hex_dump__get_value | ( | cgul_exception_t * | cex, |
| cgul_hex_dump_t | hd | ||
| ) |
Call this method at any point to get a copy of all the strings appended together that comprise elements on the internal linked list. The caller is responsible for freeing the copy by calling cgul_string_delete(). If this function fails to allocate memory, an exception is thrown.
| [in,out] | cex | c-style exception |
| [in] | hd | cgul_hex_dump instance |
| CGUL_EXPORT void cgul_hex_dump__clear | ( | cgul_exception_t * | cex, |
| cgul_hex_dump_t | hd, | ||
| int | reset_byte_count | ||
| ) |
The method lets you reuse a cgul_hex_dump object. If reset_byte_count is true, the object will be reset to the same state as any new cgul_hex_dump object would have. If reset_byte_count is false, the object will have the same state as any new cgul_hex_dump object except the byte count that runs along the left edge of the output will not be reset.
| [in] | cex | c-style exception |
| [in] | hd | cgul_hex_dump instance |
| [in] | reset_byte_count | whether to reset the byte count |