#include <llsdserialize.h>
Public Types | |
enum | e_formatter_options_type { OPTIONS_NONE = 0, OPTIONS_PRETTY = 1 } |
typedef enum LLSDFormatter::e_formatter_options_type | EFormatterOptions |
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. | |
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 381 of file llsdserialize.h.
Options for output
Definition at line 393 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 1208 of file llsdserialize.cpp.
References mBoolAlpha.
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 1213 of file llsdserialize.cpp.
References mRealFormat.
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 1218 of file llsdserialize.cpp.
References MAX_STRING, and mRealFormat.
Referenced by LLSDNotationFormatter::format(), and LLSDXMLFormatter::format_impl().
bool LLSDFormatter::mBoolAlpha [protected] |
Definition at line 444 of file llsdserialize.h.
Referenced by boolalpha(), LLSDNotationFormatter::format(), and LLSDXMLFormatter::format_impl().
std::string LLSDFormatter::mRealFormat [protected] |
Definition at line 445 of file llsdserialize.h.
Referenced by LLSDNotationFormatter::format(), LLSDXMLFormatter::format_impl(), formatReal(), and realFormat().