#include <llsdserialize.h>
Public Types | |
enum | { PARSE_FAILURE = -1 } |
Anonymous enum to indicate parsing failure. More... | |
Public Member Functions | |
LLSDParser () | |
Constructor. | |
S32 | parse (std::istream &istr, LLSD &data, S32 max_bytes) |
Call this method to parse a stream for LLSD. | |
Protected Member Functions | |
virtual | ~LLSDParser () |
Destructor. | |
virtual S32 | doParse (std::istream &istr, LLSD &data) const =0 |
Pure virtual base for doing the parse. | |
void | account (S32 bytes) const |
Accunt for bytes read outside of the istream helpers. | |
int | get (std::istream &istr) const |
get a byte off the stream | |
std::istream & | get (std::istream &istr, char *s, std::streamsize n, char delim) const |
get several bytes off the stream into a buffer. | |
std::istream & | get (std::istream &istr, std::streambuf &sb, char delim) const |
get several bytes off the stream into a streambuf | |
std::istream & | ignore (std::istream &istr) const |
ignore the next byte on the istream | |
std::istream & | putback (std::istream &istr, char c) const |
put the last character retrieved back on the stream | |
std::istream & | read (std::istream &istr, char *s, std::streamsize n) const |
read a block of n characters into a buffer | |
Protected Attributes | |
bool | mCheckLimits |
boolean to set if byte counts should be checked during parsing. | |
S32 | mMaxBytesLeft |
The maximum number of bytes left to be parsed. |
Definition at line 45 of file llsdserialize.h.
anonymous enum |
LLSDParser::~LLSDParser | ( | ) | [protected, virtual] |
LLSDParser::LLSDParser | ( | ) |
Call this method to parse a stream for LLSD.
This method parses the istream for a structured data. This method assumes that the istream is a complete llsd object -- for example an opened and closed map with an arbitrary nesting of elements. This method will return after reading one data object, allowing continued reading from the stream by the caller.
istr | The input stream. | |
data[out] | The newly parse structured data. | |
max_bytes | The maximum number of bytes that will be in the stream. Pass in LLSDSerialize::SIZE_UNLIMITED (-1) to set no byte limit. |
Definition at line 311 of file llsdserialize.cpp.
References doParse(), mCheckLimits, mMaxBytesLeft, and LLSDSerialize::SIZE_UNLIMITED.
virtual S32 LLSDParser::doParse | ( | std::istream & | istr, | |
LLSD & | data | |||
) | const [protected, pure virtual] |
Pure virtual base for doing the parse.
This method parses the istream for a structured data. This method assumes that the istream is a complete llsd object -- for example an opened and closed map with an arbitrary nesting of elements. This method will return after reading one data object, allowing continued reading from the stream by the caller.
istr | The input stream. | |
data[out] | The newly parse structured data. |
Implemented in LLSDNotationParser, LLSDXMLParser, and LLSDBinaryParser.
Referenced by parse().
int LLSDParser::get | ( | std::istream & | istr | ) | const [protected] |
get a byte off the stream
istr | The istream to work with. |
Definition at line 319 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
std::istream & LLSDParser::get | ( | std::istream & | istr, | |
char * | s, | |||
std::streamsize | n, | |||
char | delim | |||
) | const [protected] |
get several bytes off the stream into a buffer.
istr | The istream to work with. | |
s | The buffer to get into | |
n | Extract maximum of n-1 bytes and null temrinate. | |
delim | Delimiter to get until found. |
Definition at line 325 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
std::istream & LLSDParser::get | ( | std::istream & | istr, | |
std::streambuf & | sb, | |||
char | delim | |||
) | const [protected] |
get several bytes off the stream into a streambuf
istr | The istream to work with. | |
sb | The streambuf to read into | |
delim | Delimiter to get until found. |
Definition at line 336 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
std::istream & LLSDParser::ignore | ( | std::istream & | istr | ) | const [protected] |
ignore the next byte on the istream
istr | The istream to work with. |
Definition at line 346 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
Referenced by LLSDNotationParser::doParse().
std::istream & LLSDParser::putback | ( | std::istream & | istr, | |
char | c | |||
) | const [protected] |
put the last character retrieved back on the stream
istr | The istream to work with. | |
c | The character to put back |
Definition at line 353 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
Referenced by LLSDNotationParser::parseArray(), LLSDNotationParser::parseBinary(), and LLSDNotationParser::parseMap().
std::istream & LLSDParser::read | ( | std::istream & | istr, | |
char * | s, | |||
std::streamsize | n | |||
) | const [protected] |
read a block of n characters into a buffer
istr | The istream to work with. | |
s | The buffer to read into | |
n | The number of bytes to read. |
Definition at line 360 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
Referenced by LLSDBinaryParser::doParse(), LLSDBinaryParser::parseArray(), LLSDNotationParser::parseBinary(), LLSDBinaryParser::parseMap(), and LLSDBinaryParser::parseString().
void LLSDParser::account | ( | S32 | bytes | ) | const [protected] |
Accunt for bytes read outside of the istream helpers.
Conceptually const since it only modifies mutable members.
bytes | The number of bytes read. |
Definition at line 370 of file llsdserialize.cpp.
References mCheckLimits, and mMaxBytesLeft.
Referenced by LLSDBinaryParser::doParse(), LLSDNotationParser::doParse(), LLSDNotationParser::parseBinary(), LLSDBinaryParser::parseMap(), LLSDNotationParser::parseMap(), LLSDBinaryParser::parseString(), and LLSDNotationParser::parseString().
bool LLSDParser::mCheckLimits [protected] |
boolean to set if byte counts should be checked during parsing.
Definition at line 188 of file llsdserialize.h.
Referenced by account(), LLSDBinaryParser::doParse(), get(), ignore(), parse(), LLSDNotationParser::parseBinary(), LLSDBinaryParser::parseString(), putback(), and read().
S32 LLSDParser::mMaxBytesLeft [mutable, protected] |
The maximum number of bytes left to be parsed.
Definition at line 193 of file llsdserialize.h.
Referenced by account(), LLSDBinaryParser::doParse(), get(), ignore(), parse(), LLSDNotationParser::parseBinary(), LLSDNotationParser::parseMap(), LLSDBinaryParser::parseString(), LLSDNotationParser::parseString(), putback(), and read().