23 #ifndef __ccxx_Blob_hxx 24 #define __ccxx_Blob_hxx 34 #pragma warning(disable: 4251) 82 {
return(_buf == NULL ? 0 : _buf->_length); };
90 {
return(getLength()); }
100 void setLength(
uint_t length);
104 {
return(_buf == NULL ? NULL : _buf->_data); }
108 {
return(_buf == NULL ? NULL : _buf->_data); }
124 {
return((_buf->_data == NULL) || (_buf->_length == 0)); }
133 {
return(_buf->_data == NULL); }
151 Blob& append(
const char* str,
uint_t length = 0);
183 int lastIndexOf(
byte_t b,
uint_t fromIndex = END)
const;
206 {
return(indexOf(b) >= 0); }
216 int compareTo(
const Blob& other)
const;
229 byte_t& operator[](
int index);
239 byte_t operator[](
int index)
const;
248 {
return(isNull()); }
256 {
return(append(&b, 1)); }
265 {
return(
operator+=(static_cast<byte_t>(v & 0xFF))); }
273 {
return(append(str)); }
286 {
return(append(&val, 1)); }
290 {
return(
operator+=(static_cast<byte_t>(val & 0xFF))); }
294 {
return(append(str)); }
323 BlobBuf(
const BlobBuf& other,
uint_t length);
329 void reserve(
uint_t size);
341 void _makeCopy(
uint_t size,
bool unshareable =
false);
364 return(stream.write(reinterpret_cast<const char *>(b.
getData()),
365 static_cast<std::streamsize>(b.
getLength())));
374 #endif // __ccxx_Blob_hxx Blob & operator<<(byte_t val)
Append operator.
Definition: Blob.h++:285
bool isEmpty() const
Test if the Blob is empty.
Definition: Blob.h++:123
uint_t getLength() const
Get the length of the Blob.
Definition: Blob.h++:81
bool contains(byte_t b) const
Determine if the Blob contains a given byte.
Definition: Blob.h++:205
bool operator<=(const Blob &b1, const Blob &b2)
Definition: Blob.h++:356
Blob & operator+=(byte_t b)
Append a byte onto the end of the Blob.
Definition: Blob.h++:255
Blob & operator+=(int v)
Append a value onto the end of the Blob.
Definition: Blob.h++:264
int compareTo(const Blob &other) const
Compare this Blob to another.
Definition: Blob.c++:132
bool operator==(const Blob &b1, const Blob &b2)
Definition: Blob.h++:344
bool operator!() const
Unary NOT operator.
Definition: Blob.h++:247
uint_t length() const
Get the length of the Blob.
Definition: Blob.h++:89
Blob & clear()
Clear the Blob.
Definition: Blob.h++:111
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
Blob & operator<<(const char *str)
Append operator.
Definition: Blob.h++:293
Blob & operator+=(const Blob &blob)
Append (a copy of) the contents of another Blob onto the end of the Blob.
Definition: Blob.h++:281
bool isNull() const
Test if the Blob is null.
Definition: Blob.h++:132
std::ostream & operator<<(std::ostream &stream, const BitSet &bs)
Definition: BitSet.h++:383
An integer counter whose value is modified in an atomic fashion.
Definition: AtomicCounter.h++:36
static const uint_t END
A pseudo-index indicating the end of the blob.
Definition: Blob.h++:308
#define COMMONCPP_API
Definition: Common.h++:126
static const Blob null
The null Blob.
Definition: Blob.h++:305
A reference-counting, copy-on-write, threadsafe container for arbitrary binary data.
Definition: Blob.h++:45
bool operator!=(const Blob &b1, const Blob &b2)
Definition: Blob.h++:347
Blob & operator+=(const char *str)
Append a character string onto the end of the Blob.
Definition: Blob.h++:272
bool operator<(const Blob &b1, const Blob &b2)
Definition: Blob.h++:350
#define CCXX_COPY_DECLS(CLASS)
Inlines declarations of a copy constructor and assignment operator for the class CLASS.
Definition: Common.h++:295
const byte_t * getData() const
Get a pointer to the beginning of the data in the Blob.
Definition: Blob.h++:107
bool operator>=(const Blob &b1, const Blob &b2)
Definition: Blob.h++:359
Blob & operator<<(int val)
Append operator.
Definition: Blob.h++:289
Definition: AllocationMap.c++:25
bool operator>(const Blob &b1, const Blob &b2)
Definition: Blob.h++:353
byte_t * getData()
Get a pointer to the beginning of the data in the Blob.
Definition: Blob.h++:103
unsigned char byte_t
An unsigned 8-bit value.
Definition: Integers.h++:68