36 #include "commonGlobal.h"
50 #define BYTEARRAY_DECREF(d) ITOM_DECREF(&(d->m_ref))
51 #define BYTEARRAY_INCCREF(d) ITOM_INCREF(&(d->m_ref))
96 inline ByteArray(
const ByteArray& copyConstr) : d(copyConstr.d) {
if (d) {BYTEARRAY_INCCREF(d);} }
120 int length()
const {
if(d){
return (
int)strlen(d->m_pData); }
return 0; }
125 int size()
const {
if(d){
return (
int)strlen(d->m_pData); }
return 0; }
128 bool empty()
const {
if(d) {
return strlen(d->m_pData) == 0; }
return true; }
131 const char *
data()
const {
return d ? d->m_pData : &emptyChar; };
140 assert(i >= 0 && i < (
unsigned int)(size()));
143 return d->m_pData[i];
155 assert(i >= 0 && i < size());
158 return d->m_pData[i];
173 inline void decAndFree(
Data *x)
175 if (x && !(BYTEARRAY_DECREF(x)))
187 return a2 ? strcmp(a1.
data(),a2) == 0 : (a1.
size() == 0);
193 return a1 ? strcmp(a1,a2.
data()) == 0 : (a2.
size() == 0);
199 return a2 ? strcmp(a1.
data(),a2) != 0 : (a1.
size() > 0);
205 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:96
int m_ref
Definition: byteArray.h:80
basic data container for class ByteArray that is implicitely shared over multiple instances of ByteAr...
Definition: byteArray.h:78
char * m_pData
Definition: byteArray.h:81
int size() const
Definition: byteArray.h:125
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:153
static char emptyChar
Definition: byteArray.h:86
This is a Qt-free class for byte arrays (strings) without specific encoding information.
Definition: byteArray.h:64
Definition: apiFunctionsGraph.cpp:39
bool empty() const
return true if the ByteArray is empty hence its length is 0
Definition: byteArray.h:128
~ByteArray()
destructor: the internal data is deleted if no other instance needs it.
Definition: byteArray.h:99
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:138
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:185
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:197
bool operator!=(const ByteArray &a) const
return false, if the content of this ByteArray is equal to the given ByteArray a. ...
Definition: byteArray.h:167
Data * d
Definition: byteArray.h:171
ByteArray()
default constructor. The ByteArray is empty.
Definition: byteArray.h:90
const char * data() const
return the pointer to the internal character array. If it is empty, the returned pointer still points...
Definition: byteArray.h:131
int length() const
Definition: byteArray.h:120