LLSDFormatter Class Reference

Abstract base class for formatting LLSD. More...

#include <llsdserialize.h>

Inheritance diagram for LLSDFormatter:

Inheritance graph
[legend]
Collaboration diagram for LLSDFormatter:

Collaboration graph
[legend]
List of all members.

Public Types

 OPTIONS_NONE = 0
 OPTIONS_PRETTY = 1
enum  e_formatter_options_type { OPTIONS_NONE = 0, OPTIONS_PRETTY = 1 }

Public Member Functions

 LLSDFormatter ()
 Constructor.
void boolalpha (bool alpha)
 Set the boolean serialization format.
void realFormat (const std::string &format)
 Set the real format.
virtual S32 format (const LLSD &data, std::ostream &ostr, U32 options=LLSDFormatter::OPTIONS_NONE) const =0
 Call this method to format an LLSD to a stream.

Public Attributes

enum LLSDFormatter::e_formatter_options_type EFormatterOptions

Protected Member Functions

virtual ~LLSDFormatter ()
 Destructor.
void formatReal (LLSD::Real real, std::ostream &ostr) const
 Helper method which appropriately obeys the real format.

Protected Attributes

bool mBoolAlpha
std::string mRealFormat

Detailed Description

Abstract base class for formatting LLSD.

Definition at line 279 of file llsdserialize.h.


Member Enumeration Documentation

enum LLSDFormatter::e_formatter_options_type

Options for output

Enumerator:
OPTIONS_NONE 
OPTIONS_PRETTY 

Definition at line 291 of file llsdserialize.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 935 of file llsdserialize.cpp.

LLSDFormatter::LLSDFormatter (  ) 

Constructor.

LLSDFormatter

Definition at line 929 of file llsdserialize.cpp.


Member Function Documentation

void LLSDFormatter::boolalpha ( bool  alpha  ) 

Set the boolean serialization format.

Parameters:
alpha Serializes boolean as alpha if true.

Definition at line 938 of file llsdserialize.cpp.

References mBoolAlpha.

virtual S32 LLSDFormatter::format ( const LLSD data,
std::ostream &  ostr,
U32  options = LLSDFormatter::OPTIONS_NONE 
) const [pure 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

Implemented in LLSDNotationFormatter, LLSDXMLFormatter, and LLSDBinaryFormatter.

void LLSDFormatter::formatReal ( LLSD::Real  real,
std::ostream &  ostr 
) const [protected]

Helper method which appropriately obeys the real format.

Parameters:
real The real value to format.
ostr The destination stream for the data.

Definition at line 948 of file llsdserialize.cpp.

References MAX_STRING, and mRealFormat.

Referenced by LLSDNotationFormatter::format(), and LLSDXMLFormatter::format_impl().

void LLSDFormatter::realFormat ( const std::string &  format  ) 

Set the real format.

By default, the formatter will use default double serialization which is frequently frustrating for many applications. You can set the precision on the stream independently, but that still might not work depending on the value. EXAMPLES:
%.2f

Parameters:
format A format string which follows the printf format rules. Specify an empty string to return to default formatting.

Definition at line 943 of file llsdserialize.cpp.

References mRealFormat.


Member Data Documentation

enum LLSDFormatter::e_formatter_options_type LLSDFormatter::EFormatterOptions

Options for output

bool LLSDFormatter::mBoolAlpha [protected]

Definition at line 342 of file llsdserialize.h.

Referenced by boolalpha(), LLSDNotationFormatter::format(), and LLSDXMLFormatter::format_impl().

std::string LLSDFormatter::mRealFormat [protected]

Definition at line 343 of file llsdserialize.h.

Referenced by LLSDNotationFormatter::format(), LLSDXMLFormatter::format_impl(), formatReal(), and realFormat().


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