LLSDParser Class Reference

Abstract base class for LLSD parsers. More...

#include <llsdserialize.h>

Inheritance diagram for LLSDParser:

Inheritance graph
[legend]
Collaboration diagram for LLSDParser:

Collaboration graph
[legend]

List of all members.

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.


Detailed Description

Abstract base class for LLSD parsers.

Definition at line 45 of file llsdserialize.h.


Member Enumeration Documentation

anonymous enum

Anonymous enum to indicate parsing failure.

Enumerator:
PARSE_FAILURE 

Definition at line 57 of file llsdserialize.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 308 of file llsdserialize.cpp.

LLSDParser::LLSDParser (  ) 

Constructor.

LLSDParser

Definition at line 303 of file llsdserialize.cpp.


Member Function Documentation

S32 LLSDParser::parse ( std::istream &  istr,
LLSD data,
S32  max_bytes 
)

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.

Parameters:
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.
Returns:
Returns the number of LLSD objects parsed into data. Returns PARSE_FAILURE (-1) on parse failure.

Definition at line 311 of file llsdserialize.cpp.

References doParse(), mCheckLimits, mMaxBytesLeft, and LLSDSerialize::SIZE_UNLIMITED.

Here is the call graph for this function:

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.

Parameters:
istr The input stream.
data[out] The newly parse structured data.
Returns:
Returns the number of LLSD objects parsed into data. Returns PARSE_FAILURE (-1) on parse failure.

Implemented in LLSDNotationParser, LLSDXMLParser, and LLSDBinaryParser.

Referenced by parse().

Here is the caller graph for this function:

int LLSDParser::get ( std::istream &  istr  )  const [protected]

get a byte off the stream

Parameters:
istr The istream to work with.
Returns:
returns the next character.

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.

Parameters:
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.
Returns:
Returns istr.

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

Parameters:
istr The istream to work with.
sb The streambuf to read into
delim Delimiter to get until found.
Returns:
Returns istr.

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

Parameters:
istr The istream to work with.
Returns:
Returns istr.

Definition at line 346 of file llsdserialize.cpp.

References mCheckLimits, and mMaxBytesLeft.

Referenced by LLSDNotationParser::doParse().

Here is the caller graph for this function:

std::istream & LLSDParser::putback ( std::istream &  istr,
char  c 
) const [protected]

put the last character retrieved back on the stream

Parameters:
istr The istream to work with.
c The character to put back
Returns:
Returns istr.

Definition at line 353 of file llsdserialize.cpp.

References mCheckLimits, and mMaxBytesLeft.

Referenced by LLSDNotationParser::parseArray(), LLSDNotationParser::parseBinary(), and LLSDNotationParser::parseMap().

Here is the caller graph for this function:

std::istream & LLSDParser::read ( std::istream &  istr,
char *  s,
std::streamsize  n 
) const [protected]

read a block of n characters into a buffer

Parameters:
istr The istream to work with.
s The buffer to read into
n The number of bytes to read.
Returns:
Returns istr.

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().

Here is the caller graph for this function:

void LLSDParser::account ( S32  bytes  )  const [protected]

Accunt for bytes read outside of the istream helpers.

Conceptually const since it only modifies mutable members.

Parameters:
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().

Here is the caller graph for this function:


Member Data Documentation

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 documentation for this class was generated from the following files:

Generated on Fri May 16 09:03:40 2008 for SecondLife by  doxygen 1.5.5