#include <llsdserialize.h>
Inheritance diagram for LLSDFormatter:
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 |
Definition at line 279 of file llsdserialize.h.
Options for output
Definition at line 291 of file llsdserialize.h.
LLSDFormatter::~LLSDFormatter | ( | ) | [protected, virtual] |
LLSDFormatter::LLSDFormatter | ( | ) |
void LLSDFormatter::boolalpha | ( | bool | alpha | ) |
Set the boolean serialization format.
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.
data | The data to write. | |
ostr | The destination stream for the data. |
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.
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
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.
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().