Made to Order Software Corporation Logo

LLChatLib: LLSDBinaryFormatter Class Reference

LLSDBinaryFormatter Class Reference

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

#include <llsdserialize.h>

Inheritance diagram for LLSDBinaryFormatter:
Collaboration diagram for LLSDBinaryFormatter:

List of all members.

Public Member Functions

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.

 LLSDBinaryFormatter ()
 Constructor.

Protected Member Functions

void formatString (const std::string &string, std::ostream &ostr) const
 Helper method to serialize strings.

virtual ~LLSDBinaryFormatter ()
 Destructor.


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












Constructor & Destructor Documentation

LLSDBinaryFormatter::LLSDBinaryFormatter (  ) 

Constructor.

LLSDBinaryFormatter


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.

Parameters:
data The data to write.
ostr The destination stream for the data.
Returns:
Returns The number of LLSD objects fomatted out

Implements LLSDFormatter.

Here is the call graph for this function:

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.

Parameters:
string The string to write.
ostr The destination stream for the data.

The documentation for this class was generated from the following files:
Generated on Thu Sep 23 17:18:44 2010 for LLChatLib by  doxygen 1.6.3