LLSDBinaryFormatter Class Reference

Formatter which outputs the LLSD as a binary notation format. More...

#include <llsdserialize.h>

Inheritance diagram for LLSDBinaryFormatter:

Inheritance graph
Collaboration diagram for LLSDBinaryFormatter:

Collaboration graph
List of all members.

Public Member Functions

 LLSDBinaryFormatter ()
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 ()
void formatString (const std::string &string, std::ostream &ostr) const
 Helper method to serialize strings.

Detailed Description

Formatter which outputs the LLSD as a binary notation format.

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.

Constructor & Destructor Documentation

LLSDBinaryFormatter::~LLSDBinaryFormatter (  )  [protected, virtual]


Definition at line 1100 of file llsdserialize.cpp.

LLSDBinaryFormatter::LLSDBinaryFormatter (  ) 



Definition at line 1095 of file llsdserialize.cpp.

Member Function Documentation

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.
Returns The number of LLSD objects fomatted out

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().

The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:45 2010 for Second Life Viewer by  doxygen 1.4.7