#include <llsdserialize.h>
Inheritance diagram for LLSDBinaryFormatter:
Public Member Functions | |
LLSDBinaryFormatter () | |
Constructor. | |
virtual S32 | format (const LLSD &data, std::ostream &ostr, U32 options=LLSDFormatter::OPTIONS_NONE) const |
Call this method to format an LLSD to a stream. | |
Protected Member Functions | |
virtual | ~LLSDBinaryFormatter () |
Destructor. | |
void | formatString (const std::string &string, std::ostream &ostr) const |
Helper method to serialize strings. |
The binary format is a compact and efficient representation of structured data useful for when transmitting over a small data pipe or when transmission frequency is very high.
The normal boolalpha and real format commands are ignored.
All integers are transmitted in network byte order. The format is:
Undefined: '!'
Boolean: character '1' for true character '0' for false
Integer: 'i' + 4 bytes network byte order
Real: 'r' + 8 bytes IEEE double
UUID: 'u' + 16 byte unsigned integer
String: 's' + 4 byte integer size + string
Date: 'd' + 8 byte IEEE double for seconds since epoch
URI: 'l' + 4 byte integer size + string uri
Binary: 'b' + 4 byte integer size + binary data
Array: '[' + 4 byte integer size + all values + ']'
Map: '{' + 4 byte integer size every(key + value) + '}'
map keys are serialized as 'k' + 4 byte integer size + string
Definition at line 460 of file llsdserialize.h.
LLSDBinaryFormatter::~LLSDBinaryFormatter | ( | ) | [protected, virtual] |
LLSDBinaryFormatter::LLSDBinaryFormatter | ( | ) |
S32 LLSDBinaryFormatter::format | ( | const LLSD & | data, | |
std::ostream & | ostr, | |||
U32 | options = LLSDFormatter::OPTIONS_NONE | |||
) | const [virtual] |
Call this method to format an LLSD to a stream.
data | The data to write. | |
ostr | The destination stream for the data. |
Implements LLSDFormatter.
Definition at line 1104 of file llsdserialize.cpp.
References LLSD::asBinary(), LLSD::asBoolean(), LLSD::asInteger(), LLSD::asReal(), LLSD::asString(), LLSD::asUUID(), LLSD::beginArray(), LLSD::beginMap(), end, LLSD::endArray(), LLSD::endMap(), formatString(), ll_htond(), S32, LLSD::size(), LLSD::type(), LLSD::TypeArray, LLSD::TypeBinary, LLSD::TypeBoolean, LLSD::TypeDate, LLSD::TypeInteger, LLSD::TypeMap, LLSD::TypeReal, LLSD::TypeString, LLSD::TypeUndefined, LLSD::TypeURI, LLSD::TypeUUID, and UUID_BYTES.
void LLSDBinaryFormatter::formatString | ( | const std::string & | string, | |
std::ostream & | ostr | |||
) | const [protected] |
Helper method to serialize strings.
This method serializes a network byte order size and the raw string contents.
string | The string to write. | |
ostr | The destination stream for the data. |
Definition at line 1208 of file llsdserialize.cpp.
Referenced by format().