|
commore
1.0.6-SNAPSHOT
|
#include <Blob.h>
Public Types | |
| enum | { DEFAULT_BLOB_SIZE = 4096, NOT_OWNED_DATA = 0xFFFFFFFF } |
Public Member Functions | |
| Blob (const Blob &blob) | |
| Blob (size_t size, size_t allocated_size=0) | |
| Blob (const char *content, size_t size, size_t allocated_size=0) | |
| Blob & | operator= (const Blob &blob) |
| ~Blob () | |
| void | splice (Blob &blob) |
| char * | get_content () |
| const char * | get_content () const |
| size_t | get_size () const |
| size_t | get_allocated_size () const |
| char * | set (const char *content, size_t size, size_t allocated_size=0) |
| char * | set (size_t size, size_t allocated_size=0) |
| char * | set_allocated_size (size_t allocated_size) |
| void | clear () |
| long | write_xml (OBStream &) const |
| long | read_xml (IBStream &) |
| AString & | to_string (AString &s) |
| bool | from_string (const char *s) |
| long | write (OBStream &, int tab) const |
| long | read (IBStream &) |
| int | write (const Path &file) const |
| int | read (const Path &file) |
| long | write (CommBuffer &buffer) const |
| long | read (const CommBuffer &buffer) |
| int | compare (const Blob &b) const |
| bool | operator== (const Blob &b) const |
| bool | operator< (const Blob &b) const |
| bool | operator> (const Blob &b) const |
Manage raw memory block in order to exange them in commore communication. Blob and list of Blob are member of Tuple. allocated_size is automaticaly computed. The value can be rounded to optimize memory allocation.
| commore::Blob::Blob | ( | size_t | size, |
| size_t | allocated_size = 0 |
||
| ) |
Create a blob with a size and a preallocated size
| size | initial block size |
| allocated_size | total allocated size. |
| commore::Blob::Blob | ( | const char * | content, |
| size_t | size, | ||
| size_t | allocated_size = 0 |
||
| ) |
Create a blob with a pre-assigned content
| content | pointer to raw data |
| size | initial block size |
| allocated_size | total allocated size. if allocated_size == NOT_OWNED_DATA data pointed by content are not copied inside blob and blob content will reference directly the specified content. |
| commore::Blob::~Blob | ( | ) |
| void commore::Blob::clear | ( | ) |
Free blob content. Not if allocated_size == NOT_OWNED_DATA
| int commore::Blob::compare | ( | const Blob & | b | ) | const |
Compare blob content
| bool commore::Blob::from_string | ( | const char * | s | ) |
Parse a blob content from a string (Use B64 format)
| s | input string |
|
inline |
|
inline |
|
inline |
|
inline |
| int commore::Blob::read | ( | const Path & | file | ) |
Read blob content from a file (raw format)
| file |
| char* commore::Blob::set | ( | const char * | content, |
| size_t | size, | ||
| size_t | allocated_size = 0 |
||
| ) |
Set blob content // if allocated_size == NOT_OWNED_DATA the content is not copied inside blob
| char* commore::Blob::set | ( | size_t | size, |
| size_t | allocated_size = 0 |
||
| ) |
Set a new blob size. If new size need reallocation old content is copied in new content before released.
| size | new data size |
| allocated_size | new allocated size. Value taken into account only if higher than size. |
| void commore::Blob::splice | ( | Blob & | blob | ) |
Exchange content of Blobs
| blob | an other blob |
| s | string recipient |
| long commore::Blob::write | ( | OBStream & | , |
| int | tab | ||
| ) | const |
Read/Write using raw format
| int commore::Blob::write | ( | const Path & | file | ) | const |
Write blob content to a file (raw format)
| file |
| long commore::Blob::write | ( | CommBuffer & | buffer | ) | const |
Read/Write in communication buffer