36 #include "commonGlobal.h" 50 #define BYTEARRAY_DECREF(d) d->m_ref-- 51 #define BYTEARRAY_INCCREF(d) d->m_ref++ 54 #define BYTEARRAY_DECREF(d) ITOM_DECREF(&(d->m_ref)) 55 #define BYTEARRAY_INCCREF(d) ITOM_INCREF(&(d->m_ref)) 125 int length()
const {
if(d){
return (
int)strlen(d->m_pData); }
return 0; }
130 int size()
const {
if(d){
return (
int)strlen(d->m_pData); }
return 0; }
133 bool empty()
const {
if(d) {
return strlen(d->m_pData) == 0; }
return true; }
136 const char *
data()
const {
return d ? d->m_pData : &emptyChar; };
145 assert(i >= 0 && i < (
unsigned int)(size()));
148 return d->m_pData[i];
160 assert(i >= 0 && i < size());
163 return d->m_pData[i];
178 inline void decAndFree(
Data *x)
180 if (x && !(BYTEARRAY_DECREF(x)))
192 return a2 ? strcmp(a1.
data(),a2) == 0 : (a1.
size() == 0);
198 return a1 ? strcmp(a1,a2.
data()) == 0 : (a2.
size() == 0);
204 return a2 ? strcmp(a1.
data(),a2) != 0 : (a1.
size() > 0);
210 return a1 ? strcmp(a1,a2.
data()) != 0 : (a2.
size() > 0);
ByteArray(const ByteArray ©Constr)
copy constructor: the given byte array is implicitely shared between both instances until its content...
Definition: byteArray.h:101
int m_ref
Definition: byteArray.h:85
basic data container for class ByteArray that is implicitely shared over multiple instances of ByteAr...
Definition: byteArray.h:83
char * m_pData
Definition: byteArray.h:86
int size() const
Definition: byteArray.h:130
char & operator[](int i) const
access the i-th character of the ByteArray. An assertion is raised, if i is out of range ...
Definition: byteArray.h:158
static char emptyChar
Definition: byteArray.h:91
This is a Qt-free class for byte arrays (strings) without specific encoding information.
Definition: byteArray.h:69
Definition: apiFunctionsGraph.cpp:39
bool empty() const
return true if the ByteArray is empty hence its length is 0
Definition: byteArray.h:133
~ByteArray()
destructor: the internal data is deleted if no other instance needs it.
Definition: byteArray.h:104
char & operator[](unsigned int i) const
access the i-th character of the ByteArray. An assertion is raised, if i is out of range ...
Definition: byteArray.h:143
bool operator==(const ByteArray &a1, const char *a2)
comparison operator that returns true if the content of a1 is equal to the given zero-terminated stri...
Definition: byteArray.h:190
bool operator!=(const ByteArray &a1, const char *a2)
comparison operator that returns true if the content of a1 is not equal to the given zero-terminated ...
Definition: byteArray.h:202
bool operator!=(const ByteArray &a) const
return false, if the content of this ByteArray is equal to the given ByteArray a. ...
Definition: byteArray.h:172
Data * d
Definition: byteArray.h:176
ByteArray()
default constructor. The ByteArray is empty.
Definition: byteArray.h:95
const char * data() const
return the pointer to the internal character array. If it is empty, the returned pointer still points...
Definition: byteArray.h:136
int length() const
Definition: byteArray.h:125