36#include "commonGlobal.h"
50#define BYTEARRAY_DECREF(d) ITOM_DECREF(&(d->m_ref))
51#define BYTEARRAY_INCCREF(d) ITOM_INCREF(&(d->m_ref))
100 BYTEARRAY_INCCREF(d);
133 int length()
const {
if(d){
return (
int)strlen(d->m_pData); }
return 0; }
138 int size()
const {
if(d){
return (
int)strlen(d->m_pData); }
return 0; }
141 bool empty()
const {
if(d) {
return strlen(d->m_pData) == 0; }
return true; }
144 const char *
data()
const {
return d ? d->m_pData : &emptyChar; };
153 assert(i >= 0 && i < (
unsigned int)(size()));
156 return d->m_pData[i];
168 assert(i >= 0 && i < size());
171 return d->m_pData[i];
186 inline void decAndFree(
Data *x)
188 if (x && !(BYTEARRAY_DECREF(x)))
200 return a2 ? strcmp(a1.
data(),a2) == 0 : (a1.
size() == 0);
206 return a1 ? strcmp(a1,a2.
data()) == 0 : (a2.
size() == 0);
212 return a2 ? strcmp(a1.
data(),a2) != 0 : (a1.
size() > 0);
218 return a1 ? strcmp(a1,a2.
data()) != 0 : (a2.
size() > 0);
This is a Qt-free class for byte arrays (strings) without specific encoding information.
Definition byteArray.h:65
bool operator!=(const ByteArray &a) const
return false, if the content of this ByteArray is equal to the given ByteArray a.
Definition byteArray.h:180
~ByteArray()
destructor: the internal data is deleted if no other instance needs it.
Definition byteArray.h:110
int size() const
Definition byteArray.h:138
ByteArray(const ByteArray ©Constr)
copy constructor: the given byte array is implicitly shared between both instances until its content ...
Definition byteArray.h:96
const char * data() const
return the pointer to the internal character array. If it is empty, the returned pointer still points...
Definition byteArray.h:144
bool empty() const
return true if the ByteArray is empty hence its length is 0
Definition byteArray.h:141
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:151
int length() const
Definition byteArray.h:133
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:166
static char emptyChar
Definition byteArray.h:86
ByteArray()
default constructor. The ByteArray is empty.
Definition byteArray.h:90
Data * d
Definition byteArray.h:184
Definition apiFunctionsGraph.cpp:40
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:210
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:198
basic data container for class ByteArray that is implicitly shared over multiple instances of ByteArr...
Definition byteArray.h:79
char * m_pData
Definition byteArray.h:81
int m_ref
Definition byteArray.h:80