This is a Qt-free class for byte arrays (strings) without specific encoding information.
More...
|
| ByteArray () |
| default constructor. The ByteArray is empty.
|
|
| ByteArray (const char *str) |
| constructor that copies the content of str ('\0'-terminated) to this ByteArray.
|
|
| ByteArray (const ByteArray ©Constr) |
| copy constructor: the given byte array is implicitly shared between both instances until its content is changed by one of both participating instances.
|
|
| ByteArray (ByteArray &&other) |
|
| ~ByteArray () |
| destructor: the internal data is deleted if no other instance needs it.
|
|
ByteArray & | operator= (const ByteArray &rhs) |
| another ByteArray is assigned to this ByteArray. The old content is deleted and the given byte array is implicitly shared between both instances.
|
|
ByteArray & | operator= (ByteArray &&rhs) |
|
ByteArray & | operator= (const char *str) |
| a zero-terminated string is assigned to this ByteArray. The given char* is copied.
|
|
ByteArray & | append (const char *str) |
|
ByteArray & | append (const ByteArray &str) |
|
int | length () const |
|
int | size () const |
|
bool | empty () const |
| return true if the ByteArray is empty hence its length is 0
|
|
const char * | data () const |
| return the pointer to the internal character array. If it is empty, the returned pointer still points to a '\0' character. It is never NULL.
|
|
char & | operator[] (unsigned int i) const |
| access the i-th character of the ByteArray. An assertion is raised, if i is out of range
|
|
char & | operator[] (int i) const |
| access the i-th character of the ByteArray. An assertion is raised, if i is out of range
|
|
bool | operator== (const ByteArray &a) const |
| return true, if the content of this ByteArray is equal to the given ByteArray a.
|
|
bool | operator!= (const ByteArray &a) const |
| return false, if the content of this ByteArray is equal to the given ByteArray a.
|
|
This is a Qt-free class for byte arrays (strings) without specific encoding information.
This class uses implicit sharing (copy-on-write) to reduce memory usage and to avoid the needless copying of data. It can be used to store 8-bit '\0' terminated strings and is a easy and safe way to handle const char* types. ByteArray is a lightweight class without any dependency to Qt and is used in many itom libraries e.g. the Qt-free itomCommonLib library.