Blob Class Reference
Namespace | ohm::flip |
Inherits from | |
Declared in | ohm/flip/Blob.h |
Companion Guide | |
Overview
The Blob class implements a Flip class holding an opaque piece of data. The following sections will only document the public API.
Partial Class Diagram

Methods Overview
Assigning
Manipulating
Casting
Capacity
Differencing
Writing Properties
- push_encoder
- push_encoder_base64
- push_encoder_deflate
- push_encoder_escaped_ascii
- push_encoder_hexadecimal
- set_inline
Methods
ctor
Sets the value at post construction stage.
virtual void ctor (ohm::flip::Args & args); |
void ctor (const archi::UByte * data_ptr, size_t data_size); |
The first version sets the value from a cascaded arguments object ohm::flip::Args
set
Sets the data.
void set (const archi::UByte * data_ptr, size_t data_size); |
void set (const std::string & str); |
The second version is a convenient function that transform a std::string in an opaque data type and set it to this. It is usually used in conjonction with the Encoder_ESCAPED_ASCII using push_encoder_escaped_ascii .
subset
Sets a part of the data, leaving the rest untouched.
void subset (size_t data_pos, const archi::UByte * data_ptr, size_t data_size); |
The function will replace the data in the range [data_pos; data_pos + data_size) by the data [data_ptr; data_ptr + data_size)
get
Returns the data of this .
const Data & get () const; |
WARNING:it is invalid to call this function when the object is being restored
to_string
Convenient function that returns the data of this as a std::string .
std::string to_string () const; |
WARNING:The to_string method returns the string by value, not by reference.
WARNING:it is invalid to call this function when the object is being restored
get_old_data
Returns the old data of this .
const Data & get_old_data () const; |
WARNING:it is invalid to call this function when the object is being inited
empty
Convenient function that returns true if data of this is empty, false otherwise.
bool empty () const; |
WARNING:it is invalid to call this function when the object is being restored
size
Convenient function that returns the size of the data of this .
size_t size () const; |
WARNING:it is invalid to call this function when the object is being restored
did_data_change
Returns true if the old data is different from the current data.
bool did_data_change () const; |
Note:Outside of an observer document_changed call, this will always return false
push_encoder
Push an encoder to encoder stack of this to indicates to the back-end writer how the data should be written.
void push_encoder (Encoder encoder); |
The encoders properties are detailed in the Encoder Enum Reference chapter.
push_encoder_base64
Implements an alias to push_encoder (Encoder_BASE64)
void push_encoder_base64 (); |
The encoders properties are detailed in the Encoder Enum Reference chapter.
push_encoder_deflate
Implements an alias to push_encoder (Encoder_DEFLATE)
void push_encoder_deflate (); |
The encoders properties are detailed in the Encoder Enum Reference chapter.
push_encoder_escaped_ascii
Implements an alias to push_encoder (Encoder_ESCAPED_ASCII)
void push_encoder_escaped_ascii (); |
The encoders properties are detailed in the Encoder Enum Reference chapter.
This encoder is generally used when this is holding a human readable character string.
push_encoder_hexadecimal
Implements an alias to push_encoder (Encoder_HEXADECIMAL)
void push_encoder_hexadecimal (); |
The encoders properties are detailed in the Encoder Enum Reference chapter.
set_inline
Indicates to the back-end data writer that the data should be written inline in the object data member. By default the back-end data writter will write the data out-of-line.
void set_inline (bool inline_flag = true); |
Blobs of data are usually written out-of-line in the document. This means that the member defining the blob only makes a reference to the blob object, then the blob itself is written as a separate object.
The set_inline property will attempt to write the data inline in the parent object attributes definition.
This property is usually used for the Encoder_ESCAPED_ASCII and Encoder_HEXADECIMAL to make the document more human readable.
ListingInlined version of a blob
57 obj << |
/ClassName ohm.studio.ClientData |
/AttributeName _user_name /Type /Blob /Inline /Length 6 /Filter [ /EscapedAsciiDecode ] raphael |
>> |
endobj |
ListingNon-inlined version of the previous blob
57 obj << |
/ClassName ohm.studio.ClientData |
/AttributeName _user_name /Type /Blob /Ref 58 |
>> |
endobj |
58 obj << |
/Blob |
/Length 6 |
/Filter [ /EscapedAsciiDecode ] |
>> |
stream |
raphael |
endstream |
endobj |