|
Yate
|
A class that holds just a block of raw data. More...
#include <yateclass.h>
Public Member Functions | |
| DataBlock (unsigned int overAlloc=0) | |
| DataBlock (const DataBlock &value) | |
| DataBlock (const DataBlock &value, unsigned int overAlloc) | |
| DataBlock (void *value, unsigned int len, bool copyData=true, unsigned int overAlloc=0) | |
| virtual | ~DataBlock () |
| void * | data () const |
| unsigned char * | data (unsigned int offs, unsigned int len=1) const |
| int | at (unsigned int offs, int defvalue=-1) const |
| bool | null () const |
| unsigned int | length () const |
| unsigned int | size () const |
| unsigned int | overAlloc () const |
| void | overAlloc (unsigned int bytes) |
| void | clear (bool deleteData=true) |
| DataBlock & | assign (void *value, unsigned int len, bool copyData=true, unsigned int allocated=0) |
| bool | change (unsigned int pos, const void *buf, unsigned int bufLen, unsigned int extra=0, int extraVal=0, bool mayOverlap=true) |
| bool | change8hton (unsigned int pos, uint64_t value) |
| bool | change4hton (unsigned int pos, uint32_t value) |
| bool | change3hton (unsigned int pos, uint32_t value) |
| bool | change2hton (unsigned int pos, uint16_t value) |
| bool | changeHton (unsigned int pos, uint64_t value, uint8_t bytes) |
| bool | changeLsb (unsigned int pos, uint64_t value, uint8_t bytes=8) |
| void | append (const void *value, unsigned int len, bool mayOverlap=true) |
| void | append (const DataBlock &value, bool mayOverlap=true) |
| void | append (const String &value) |
| void | appendBytes (unsigned int count, uint8_t val=0) |
| void | append8hton (uint64_t value) |
| void | append4hton (uint32_t value) |
| void | append3hton (uint32_t value) |
| void | append2hton (uint16_t value) |
| void | appendHton (uint64_t value, uint8_t bytes) |
| void | append8lsb (uint64_t value, uint8_t bytes=8) |
| void | append1 (uint8_t value) |
| void | insert (const void *buf, unsigned int bufLen, unsigned int pos=0, bool mayOverlap=true) |
| void | insert (const DataBlock &value, unsigned int pos=0, bool mayOverlap=true) |
| void | insertBytes (unsigned int count, unsigned int pos=0, uint8_t val=0) |
| void | insert8hton (uint64_t value, unsigned int pos=0) |
| void | insert4hton (uint32_t value, unsigned int pos=0) |
| void | insert3hton (uint32_t value, unsigned int pos=0) |
| void | insert2hton (uint16_t value, unsigned int pos=0) |
| void | insertHton (uint64_t value, uint8_t bytes=8, unsigned int pos=0) |
| void | insertLsb (uint64_t value, uint8_t bytes=8, unsigned int pos=0) |
| void | insert1 (uint8_t value, unsigned int pos=0) |
| void | resize (unsigned int len, bool keepData=false, bool reAlloc=true) |
| void | truncate (unsigned int len, bool reAlloc=true) |
| void | cut (unsigned int pos, unsigned int len, bool reAlloc=true) |
| void | cut (int len) |
| int | operator[] (signed int index) const |
| int | operator[] (unsigned int index) const |
| DataBlock & | operator= (const DataBlock &value) |
| DataBlock & | operator+= (const DataBlock &value) |
| DataBlock & | operator+= (const String &value) |
| bool | convert (const DataBlock &src, const String &sFormat, const String &dFormat, unsigned maxlen=0) |
| bool | changeHex (unsigned int pos, const char *data, unsigned int len, char sep=0, bool guessSep=true, bool emptyOk=true, int *res=0) |
| bool | changeHex (unsigned int pos, const String &data, char sep=0, bool guessSep=true, bool emptyOk=true, int *res=0) |
| bool | appendHex (const String &data, char sep=0, bool guessSep=true, bool emptyOk=true, int *res=0) |
| bool | unHexify (const char *data, unsigned int len, char sep) |
| bool | unHexify (const char *data, unsigned int len) |
| bool | unHexify (const String &data) |
| String & | sqlEscape (String &str, char extraEsc=0) const |
| String | sqlEscape (char extraEsc) const |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual bool | alive () const |
| virtual void | destruct () |
| virtual const String & | toString () const |
| virtual const String & | traceId () const |
| virtual void * | getObject (const String &name) const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static const DataBlock & | empty () |
| static String & | sqlEscape (String &str, const void *data, unsigned int len, char extraEsc=0) |
| static void | moveData (void *buf, unsigned int bufLen, unsigned int len, unsigned int dPos, unsigned int sPos, int fill=-1) |
| static void | rebuildDataInsert (void *dest, unsigned int dLen, const void *src, unsigned int sLen, unsigned int pos, unsigned int space, int fill=-1) |
| static void | rebuildDataRemove (void *dest, unsigned int dLen, const void *src, unsigned int sLen, unsigned int pos, unsigned int space, int fillAfter=-1) |
| static uint64_t | ntoh8advance (const uint8_t *&buf) |
| static uint64_t | ntoh8advance (const uint8_t *&buf, unsigned int &len) |
| static uint64_t | ntoh8 (const uint8_t *buf) |
| static void | hton8advance (uint8_t *&buf, uint64_t val) |
| static void | hton8advance (uint8_t *&buf, uint64_t val, unsigned int &len) |
| static void | hton8 (uint8_t *buf, uint64_t val) |
| static uint32_t | ntoh4advance (const uint8_t *&buf) |
| static uint32_t | ntoh4advance (const uint8_t *&buf, unsigned int &len) |
| static uint32_t | ntoh4 (const uint8_t *buf) |
| static void | hton4advance (uint8_t *&buf, uint32_t val) |
| static void | hton4advance (uint8_t *&buf, uint32_t val, unsigned int &len) |
| static void | hton4 (uint8_t *buf, uint32_t val) |
| static uint32_t | ntoh3advance (const uint8_t *&buf) |
| static uint32_t | ntoh3advance (const uint8_t *&buf, unsigned int &len) |
| static uint32_t | ntoh3 (const uint8_t *buf) |
| static void | hton3advance (uint8_t *&buf, uint32_t val) |
| static void | hton3advance (uint8_t *&buf, uint32_t val, unsigned int &len) |
| static void | hton3 (uint8_t *buf, uint32_t val) |
| static uint16_t | ntoh2advance (const uint8_t *&buf) |
| static uint16_t | ntoh2advance (const uint8_t *&buf, unsigned int &len) |
| static uint16_t | ntoh2 (const uint8_t *buf) |
| static void | hton2advance (uint8_t *&buf, uint16_t val) |
| static void | hton2advance (uint8_t *&buf, uint16_t val, unsigned int &len) |
| static void | hton2 (uint8_t *buf, uint16_t val) |
| static uint64_t | ntohAdvance (const uint8_t *&buf, uint8_t bytes) |
| static uint64_t | ntohAdvance (const uint8_t *&buf, unsigned int &len, uint8_t bytes) |
| static uint64_t | ntoh (const uint8_t *buf, uint8_t bytes) |
| static void | htonAdvance (uint8_t *&buf, uint64_t val, uint8_t bytes) |
| static void | htonAdvance (uint8_t *&buf, uint64_t val, unsigned int &len, uint8_t bytes) |
| static void | hton (uint8_t *buf, uint64_t val, uint8_t bytes) |
| static uint64_t | lsbAdvance (const uint8_t *&buf, uint8_t bytes) |
| static uint64_t | lsbAdvance (const uint8_t *&buf, unsigned int &len, uint8_t bytes) |
| static uint64_t | lsb (const uint8_t *buf, uint8_t bytes) |
| static void | lsbSetAdvance (uint8_t *&buf, uint64_t val, uint8_t bytes) |
| static void | lsbSetAdvance (uint8_t *&buf, uint64_t val, unsigned int &len, uint8_t bytes) |
| static void | lsbSet (uint8_t *buf, uint64_t val, uint8_t bytes) |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
A class that holds just a block of raw data.
The DataBlock holds a data buffer with no specific formatting.
| DataBlock | ( | unsigned int | overAlloc = 0 | ) |
Constructs an empty data block
| overAlloc | How many bytes of memory to overallocate |
Copy constructor with overallocation
| value | Data block to copy from |
| overAlloc | How many bytes of memory to overallocate |
| DataBlock | ( | void * | value, |
| unsigned int | len, | ||
| bool | copyData = true, | ||
| unsigned int | overAlloc = 0 ) |
Constructs an initialized data block
| value | Data to assign, may be NULL to fill with zeros |
| len | Length of data, may be zero (then value is ignored) |
| copyData | True to make a copy of the data, false to just insert the pointer |
| overAlloc | How many bytes of memory to overallocate |
|
virtual |
Destroys the data, disposes the memory.
|
inline |
|
inline |
Append a String to the current block
| value | String to append |
References String::c_str(), and String::length().
|
inline |
Append data to the current block
| value | Data to append |
| len | Length of data |
| mayOverlap | Set it to false if you are sure the buffer it's not inside current block |
|
inline |
Append 1 byte to the current block
| value | Value to append |
|
inline |
Append unsigned integer data to the current block using network byte order
| value | Value to append |
|
inline |
Append unsigned integer data to the current block using network byte order
| value | Value to append |
|
inline |
Append unsigned integer data to the current block using network byte order
| value | Value to append |
|
inline |
Append unsigned integer data to the current block using network byte order
| value | Value to append |
|
inline |
Append unsigned integer data to the current block using LSB byte order
| value | Value to append |
| bytes | Number of bytes to handle |
|
inline |
Append bytes to current block
| count | Number of bytes to append |
| val | Value to fill |
|
inline |
Append data in current block from a hexadecimal string representation. Each octet must be represented in the input string with 2 hexadecimal characters. If a separator is specified, the octets in input string must be separated using exactly 1 separator. Only 1 leading or 1 trailing separators are allowed.
| data | Input character string |
| sep | Separator character used between octets. 0 if no separator is expected or should be guessed |
| guessSep | Guess separator value. Ignored if 'sep' is non 0 |
| emptyOk | Return success on empty hex buffer, false otherwise |
| res | Optional pointer to be filled with result. Negative on failure, number of used bytes otherwise |
|
inline |
Append unsigned integer data to the current block using network byte order
| value | Value to append |
| bytes | Number of bytes to handle |
| DataBlock & assign | ( | void * | value, |
| unsigned int | len, | ||
| bool | copyData = true, | ||
| unsigned int | allocated = 0 ) |
Assign data to the object
| value | Data to assign, may be NULL to fill with zeros |
| len | Length of data, may be zero (then value is ignored) |
| copyData | True to make a copy of the data, false to just insert the pointer |
| allocated | Real allocated data length in case it should not be copied |
|
inline |
Get the value of a single byte inside the stored data
| offs | Byte offset inside the stored data |
| defvalue | Default value to return if offset is outside data |
| bool change | ( | unsigned int | pos, |
| const void * | buf, | ||
| unsigned int | bufLen, | ||
| unsigned int | extra = 0, | ||
| int | extraVal = 0, | ||
| bool | mayOverlap = true ) |
Change the current block. Insert or append data and/or fill with value
| pos | Buffer position, append at end if past buffer end |
| buf | Data to copy |
| bufLen | Data length, ignored if 'buf' is NULL |
| extra | Number of extra filled bytes to handle after given buffer |
| extraVal | Value to fill |
| mayOverlap | Set it to false if a buffer is given and you are sure it's not inside current block |
|
inline |
Change (append or insert unsigned integer data) to the current block using network byte order
| pos | Buffer position, append at end if past buffer end |
| value | Value to set |
|
inline |
Change (append or insert unsigned integer data) to the current block using network byte order
| pos | Buffer position, append at end if past buffer end |
| value | Value to set |
|
inline |
Change (append or insert unsigned integer data) to the current block using network byte order
| pos | Buffer position, append at end if past buffer end |
| value | Value to set |
|
inline |
Change (append or insert unsigned integer data) to the current block using network byte order
| pos | Buffer position, append at end if past buffer end |
| value | Value to set |
| bool changeHex | ( | unsigned int | pos, |
| const char * | data, | ||
| unsigned int | len, | ||
| char | sep = 0, | ||
| bool | guessSep = true, | ||
| bool | emptyOk = true, | ||
| int * | res = 0 ) |
Change data data in current block from a hexadecimal string representation. Append or insert. Each octet must be represented in the input string with 2 hexadecimal characters. If a separator is specified, the octets in input string must be separated using exactly 1 separator. Only 1 leading or 1 trailing separators are allowed.
| pos | Position to insert, append if past buffer end |
| data | Input character string |
| len | Length of the input string |
| sep | Separator character used between octets. 0 if no separator is expected or should be guessed |
| guessSep | Guess separator value. Ignored if 'sep' is non 0 |
| emptyOk | Return success on empty hex buffer, false otherwise |
| res | Optional pointer to be filled with result. Negative on failure, number of used bytes otherwise |
|
inline |
Change data data in current block from a hexadecimal string representation. Append or insert. Each octet must be represented in the input string with 2 hexadecimal characters. If a separator is specified, the octets in input string must be separated using exactly 1 separator. Only 1 leading or 1 trailing separators are allowed.
| pos | Position to insert, append if past buffer end |
| data | Input character string |
| sep | Separator character used between octets. 0 if no separator is expected or should be guessed |
| guessSep | Guess separator value. Ignored if 'sep' is non 0 |
| emptyOk | Return success on empty hex buffer, false otherwise |
| res | Optional pointer to be filled with result. Negative on failure, number of used bytes otherwise |
References String::c_str(), and String::length().
|
inline |
Change (append or insert unsigned integer data) to the current block using network byte order
| pos | Buffer position, append at end if past buffer end |
| value | Value to set |
| bytes | Number of bytes to handle |
|
inline |
Change (append or insert unsigned integer data) to the current block using LSB byte order
| pos | Buffer position, append at end if past buffer end |
| value | Value to set |
| bytes | Number of bytes to handle |
| void clear | ( | bool | deleteData = true | ) |
Clear the data and optionally free the memory
| deleteData | True to free the deta block, false to just forget it |
| bool convert | ( | const DataBlock & | src, |
| const String & | sFormat, | ||
| const String & | dFormat, | ||
| unsigned | maxlen = 0 ) |
Convert data from a different format
| src | Source data block |
| sFormat | Name of the source format |
| dFormat | Name of the destination format |
| maxlen | Maximum amount to convert, 0 to use source |
|
inline |
Cut off a number of bytes from the data block
| len | Amount to cut, positive to cut from end, negative to cut from start of block. |
| void cut | ( | unsigned int | pos, |
| unsigned int | len, | ||
| bool | reAlloc = true ) |
Cut off a number of bytes from the data block
| pos | Block position |
| len | Amount to cut. Clear block if all data is removed |
| reAlloc | Re-allocate buffer. Set it it to false to move/reset data only This parameter is ignored if data is cleared |
|
inline |
Get a pointer to the stored data.
Referenced by append(), RefStorage::data(), Cipher::decrypt(), Cipher::encrypt(), Hasher::hmac(), Hasher::hmacStart(), Cipher::initVector(), insert(), operator=(), Cipher::setKey(), SliceVector< Obj >::unHexify(), Hasher::update(), Compressor::writeComp(), Stream::writeData(), and Compressor::writeDecomp().
|
inline |
Get a pointer to a byte range inside the stored data.
| offs | Byte offset inside the stored data |
| len | Number of bytes that must be valid starting at offset |
|
static |
A static empty data block
|
inlinestatic |
Convert bytes value from host byte order to network byte order.
| buf | Buffer pointer. Assumed to be valid |
| val | The value |
| bytes | The number of bytes to convert |
|
inlinestatic |
Convert 2 bytes value from host byte order to network byte order.
| buf | Buffer pointer. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 2 bytes value from host byte order to network byte order. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 2 bytes value from host byte order to network byte order. Advance in buffer, increase length
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert 3 bytes value from host byte order to network byte order.
| buf | Buffer pointer. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 3 bytes value from host byte order to network byte order. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 3 bytes value from host byte order to network byte order. Advance in buffer, increase length
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert 4 bytes value from host byte order to network byte order.
| buf | Buffer pointer. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 4 bytes value from host byte order to network byte order. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 4 bytes value from host byte order to network byte order. Advance in buffer, increase length
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert 8 bytes value from host byte order to network byte order.
| buf | Buffer pointer. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 8 bytes value from host byte order to network byte order
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
|
inlinestatic |
Convert 8 bytes value from host byte order to network byte order. Advance in buffer, increase length
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert bytes value from host byte order to network byte order. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| bytes | The number of bytes to convert |
|
inlinestatic |
Convert bytes value from host byte order to network byte order. Advance in buffer, increase length
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| len | Buffer length. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inline |
|
inline |
Insert data in the current block
| buf | Data to copy |
| bufLen | Data length |
| pos | Buffer position |
| mayOverlap | Set it to false if you are sure the buffer it's not inside current block |
|
inline |
Insert 1 byte in the current block
| value | Value to insert |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Insert unsigned integer data in the current block using network byte order
| value | Value to insert |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Insert unsigned integer data in the current block using network byte order
| value | Value to insert |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Insert unsigned integer data in the current block using network byte order
| value | Value to insert |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Insert unsigned integer data in the current block using network byte order
| value | Value to insert |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Insert bytes in current block
| count | Number of bytes to insert |
| pos | Buffer position |
| val | Value to fill |
|
inline |
Insert unsigned integer data in the current block using network byte order
| value | Value to insert |
| bytes | Number of bytes to handle |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Insert unsigned integer data in the current block using LSB byte order
| value | Value to insert |
| bytes | Number of bytes to handle |
| pos | Buffer position, append at end if greater than current length |
|
inline |
Get the length of the stored data.
Referenced by append(), Cipher::decrypt(), Cipher::encrypt(), Hasher::hmac(), Hasher::hmacStart(), Cipher::initVector(), insert(), RefStorage::length(), operator=(), Cipher::setKey(), SliceVector< Obj >::unHexify(), Hasher::update(), Compressor::writeComp(), Stream::writeData(), and Compressor::writeDecomp().
|
inlinestatic |
Convert bytes from buffer to LSB unsigned int
| buf | Buffer pointer. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inlinestatic |
Convert bytes from buffer to LSB unsigned int. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inlinestatic |
Convert bytes from buffer to LSB unsigned int. Advance in buffer, decrease buffer length
| buf | Buffer pointer reference. Assumed to be valid |
| len | Buffer length. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inlinestatic |
Set value in buffer using LSB order
| buf | Buffer pointer. Assumed to be valid |
| val | The value |
| bytes | The number of bytes to convert |
|
inlinestatic |
Set value in buffer using LSB order. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| bytes | The number of bytes to convert |
|
inlinestatic |
Set value in buffer using LSB order. Advance in buffer, increase length
| buf | Buffer pointer reference. Assumed to be valid |
| val | The value |
| len | Buffer length. Assumed to be valid |
| bytes | The number of bytes to convert |
|
static |
Safely move data in the same buffer. No change is done if destination and source position are the same
| buf | Buffer pointer |
| bufLen | Buffer length |
| len | Number of items to copy (move) |
| dPos | Destination buffer position |
| sPos | Source buffer position |
| fill | Value to reset empty (moved) memory if not negative |
|
inlinestatic |
Convert bytes from buffer to host byte order unsigned int
| buf | Buffer pointer. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inlinestatic |
Convert 2 bytes from buffer to host byte order unsigned int
| buf | Buffer pointer. Assumed to be valid |
|
inlinestatic |
Convert 2 bytes from buffer to host byte order unsigned int. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
|
inlinestatic |
Convert 2 bytes from buffer to host byte order unsigned int. Advance in buffer, decrease buffer length
| buf | Buffer pointer reference. Assumed to be valid |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert 3 bytes from buffer to host byte order unsigned int
| buf | Buffer pointer. Assumed to be valid |
|
inlinestatic |
Convert 3 bytes from buffer to host byte order unsigned int. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
|
inlinestatic |
Convert 3 bytes from buffer to host byte order unsigned int. Advance in buffer, decrease buffer length
| buf | Buffer pointer reference. Assumed to be valid |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert 4 bytes from buffer to host byte order unsigned int
| buf | Buffer pointer. Assumed to be valid |
|
inlinestatic |
Convert 4 bytes from buffer to host byte order unsigned int. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
|
inlinestatic |
Convert 4 bytes from buffer to host byte order unsigned int. Advance in buffer, decrease buffer length
| buf | Buffer pointer reference. Assumed to be valid |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert 8 bytes from buffer to host byte order unsigned int
| buf | Buffer pointer. Assumed to be valid |
|
inlinestatic |
Convert 8 bytes from buffer to host byte order unsigned int. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
|
inlinestatic |
Convert 8 bytes from buffer to host byte order unsigned int. Advance in buffer, decrease buffer length.
| buf | Buffer pointer reference. Assumed to be valid |
| len | Buffer length. Assumed to be valid |
|
inlinestatic |
Convert bytes from buffer to host byte order unsigned int. Advance in buffer
| buf | Buffer pointer reference. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inlinestatic |
Convert bytes from buffer to host byte order unsigned int. Advance in buffer, decrease buffer length
| buf | Buffer pointer reference. Assumed to be valid |
| len | Buffer length. Assumed to be valid |
| bytes | The number of bytes to convert |
|
inline |
Checks if the block holds a NULL pointer.
|
inline |
Byte indexing operator with signed parameter
| index | Index of the byte to retrieve |
|
inline |
Byte indexing operator with unsigned parameter
| index | Index of the byte to retrieve |
|
inline |
Get the memory overallocation setting.
|
inline |
Set the memory overallocation.
| bytes | How many bytes of memory to overallocate |
|
static |
Rebuild a data buffer after data was inserted. It is assumed the destination and source don't overlap
| dest | Destination buffer |
| dLen | Destination buffer length |
| src | Source buffer |
| sLen | Source buffer length |
| pos | Insert position |
| space | Amount of inserted space |
| fill | Value to reset inserted memory if not negative |
|
static |
Rebuild a data buffer after data was removed. It is assumed the destination and source don't overlap
| dest | Destination buffer |
| dLen | Destination buffer length |
| src | Source buffer |
| sLen | Source buffer length |
| pos | Remove position |
| space | Amount of removed space |
| fillAfter | Value to reset memory until buffer end if not negative |
| void resize | ( | unsigned int | len, |
| bool | keepData = false, | ||
| bool | reAlloc = true ) |
Resize (re-alloc or free) this block if required size is not the same as the current one
| len | Required block size. Clear if 0 |
| keepData | Keep old data This parameter is ignored if data is cleared |
| reAlloc | Re-allocate buffer. Set it it to false to move/reset data only This parameter is ignored if data is cleared |
|
inline |
Get the length of the allocated data
|
inline |
Create an escaped string suitable for use in SQL queries
| extraEsc | Character to escape other than the default ones |
Add block values as escaped string suitable for use in SQL queries. Escape binary zeros and other special characters
| str | Destination string |
| extraEsc | Character to escape other than the default ones |
|
static |
Add block values as escaped string suitable for use in SQL queries. Escape binary zeros and other special characters
| str | Destination string |
| data | Binary data buffer |
| len | Buffer length |
| extraEsc | Character to escape other than the default ones |
|
inline |
Truncate the data block
| len | The maximum length to keep |
| reAlloc | Re-allocate buffer. Set it it to false to move/reset data only This parameter is ignored if data is cleared |
|
inline |
Build this data block from a hexadecimal string representation. Each octet must be represented in the input string with 2 hexadecimal characters. This method guesses if separators are used. If so the octets in input string must be separated using exactly 1 separator. Only 1 leading or 1 trailing separators are allowed.
| data | Input character string |
| len | Length of the input string |
|
inline |
Build this data block from a hexadecimal string representation. Each octet must be represented in the input string with 2 hexadecimal characters. If a separator is specified, the octets in input string must be separated using exactly 1 separator. Only 1 leading or 1 trailing separators are allowed.
| data | Input character string |
| len | Length of the input string |
| sep | Separator character used between octets. 0 if no separator is expected |
Referenced by SliceVector< Obj >::unHexify().
|
inline |
Build this data block from a hexadecimal string representation. This version parses a String and guesses separators presence.
| data | Input character string |
References String::c_str(), and String::length().