Abstract base class for formatting LLSD. More...
#include <llsdserialize.h>
Public Types | |
enum | e_formatter_options_type |
typedef enum LLSDFormatter::e_formatter_options_type | EFormatterOptions |
Public Member Functions | |
void | boolalpha (bool alpha) |
Set the boolean serialization 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. | |
LLSDFormatter () | |
Constructor. | |
void | realFormat (const std::string &format) |
Set the real format. | |
Protected Member Functions | |
void | formatReal (LLSD::Real real, std::ostream &ostr) const |
Helper method which appropriately obeys the real format. | |
virtual | ~LLSDFormatter () |
Destructor. |
Abstract base class for formatting LLSD.
Options for output
Options for output
LLSDFormatter::LLSDFormatter | ( | ) |
Constructor.
void LLSDFormatter::boolalpha | ( | bool | alpha | ) |
Set the boolean serialization format.
alpha | Serializes boolean as alpha if true. |
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. |
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. |