dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
23 #ifndef common_bytes_hpp
24 #define common_bytes_hpp
164 void random(
size_t octets );
171 std::string
hexDump(
size_t n )
const;
size_t size_
The array size in Octets (using an int as that is what OpenSSL uses)
std::string encodeBase64() const
Encodes the this Bytes into a base64-encoded string.
Octet * getArray() const
Return the array.
const size_t alloc_block
Always allocate chunks of this size.
Bytes & decodeBase64(const std::string &src)
Decodes the base64 string into this Bytes.
Octet getOctet(size_t index) const
Return the Octet at index.
MatchType
The way in which two Bytes instances match.
void free()
Free and clear data.
void reserve(size_t size)
Reserve memory in the Bytes.
Bytes(Octet *data, size_t size)
Construct an Bytes by taking ownership of existing data (which will be freed when this object is dest...
An array of Octets with size elements.
Bytes(const std::string &s)
Construct and fill from a std::string, not including the NULL terminator (so size will be string....
void append(const Bytes &src)
Append another Bytes.
void random(size_t octets)
Generate a random set of Octets.
@ Mismatch
The local array does not match the other array.
Octet * array_
The Octet array.
@ Contains
The local array contains the other array, but the local array has more data.
Common and utility interfaces.
std::string asString() const
Convert to a std::string.
uint8_t Octet
Octet aka 'byte'.
MatchType match(const Bytes &other, size_t index, size_t &octets)
Match this Bytes from index to the other array (entirely).
@ Full
The local and other array are equal in content and size.
std::string hexDump(size_t n) const
hex dump the first n octets of the data.
@ Contained
The local array is contained in the other array, but the other array has more data.
Bytes & operator=(const std::string &s)
Assign from std::string, not including a NULL terminator (so size will be string.length() ).
size_t getSize() const
Return the array size.
Bytes()
Construct an empty Bytes.
size_t allocated_size
The allocated size, always >= size.
virtual ~Bytes()
Destruct and clean.