27 #include "../core/utils/HexUtils.h" 139 memcpy(
m_data, data, size);
146 std::size_t newCapacity = offset + size;
148 char* newData =
new char[newCapacity];
150 memcpy(newData,
m_data, offset);
152 memcpy(newData + offset, data, size);
154 take(newData, newCapacity);
158 memcpy(
m_data + offset, data, size);
195 return std::string(
"");
199 std::string result(hexStr);
std::size_t bytesUsed() const
It returns the number of used bytes in the internal buffer.
A class for representing binary data.
char * m_data
The buffer data.
std::string toString() const
It returns the byte array in an string notation.
char * getData() const
It returns the data array.
AbstractData * clone() const
It creates a new clone of the byte array.
A base class for values that can be retrieved from the data access module.
ByteArray()
It creates a new empty byte array.
ByteArray & operator=(const ByteArray &rhs)
Assignment operator.
std::size_t capacity() const
It returns the size of the internal buffer.
std::size_t m_bytesOccupied
The number of bytes occupied in the buffer.
std::size_t m_capacity
The number of bytes allocated by the internal buffer.
void copy(char *data, std::size_t size)
It copies the data from the given pointer to the byte array.
void setBytesUsed(std::size_t size)
It sets the number of used bytes in the internal buffer.
void clear()
It clears the byte array.
char * Binary2Hex(const char *s, std::size_t size)
Each char from the array of characters in binary format is converted into a pair of hex characters...
A class for representing binary data.
void take(char *data, std::size_t size)
It takes the ownership of the external data buffer.