reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::LazyParser Class Referenceabstract

The base-class for all lazily-parsed SIP grammar elements. More...

#include <LazyParser.hxx>

Inheritance diagram for resip::LazyParser:
[legend]

Public Member Functions

 LazyParser (const HeaderFieldValue &headerFieldValue)
 
 LazyParser (const char *buf, int length)
 
 LazyParser (const HeaderFieldValue &headerFieldValue, HeaderFieldValue::CopyPaddingEnum e)
 
 LazyParser (const LazyParser &rhs)
 
 LazyParser (const LazyParser &rhs, HeaderFieldValue::CopyPaddingEnum e)
 
LazyParser & operator= (const LazyParser &rhs)
 
virtual ~LazyParser ()
 
virtual EncodeStream & encodeParsed (EncodeStream &str) const =0
 
virtual void parse (ParseBuffer &pb)=0
 
EncodeStream & encode (EncodeStream &str) const
 Encodes this element to a stream, in the fashion it should be represented on the wire.
 
bool isParsed () const
 Returns true iff a parse has been attempted.
 
HeaderFieldValue & getHeaderField ()
 
void checkParsed () const
 
void checkParsed ()
 
void doParse () const
 
void markDirty () const
 
bool isWellFormed () const
 Returns true iff this element was parsed successfully, according to the implementation of parse().
 

Protected Member Functions

 LazyParser ()
 
void clear ()
 
virtual const Data & errorContext () const =0
 

Friends

class Contents
 

Detailed Description

The base-class for all lazily-parsed SIP grammar elements.

Subclasses of this are parse-on-access; the parse will be carried out (if it hasn't already) the first time one of the members is accessed. Right now, all header field values and SIP bodies are lazily parsed.

Application writers are expected to make consistent use of isWellFormed() in order to determine whether an element is parseable. Using a try/catch block around accesses will not work as expected, since an exception will only be thrown the first time an access is made, and it is determined that the element isn't parseable.

Definition at line 34 of file LazyParser.hxx.

Constructor & Destructor Documentation

◆ LazyParser() [1/6]

LazyParser::LazyParser ( const HeaderFieldValue &  headerFieldValue)
explicit

Definition at line 16 of file LazyParser.cxx.

◆ LazyParser() [2/6]

LazyParser::LazyParser ( const char *  buf,
int  length 
)

Definition at line 28 of file LazyParser.cxx.

◆ LazyParser() [3/6]

LazyParser::LazyParser ( const HeaderFieldValue &  headerFieldValue,
HeaderFieldValue::CopyPaddingEnum  e 
)

Definition at line 22 of file LazyParser.cxx.

◆ LazyParser() [4/6]

LazyParser::LazyParser ( const LazyParser &  rhs)

Definition at line 39 of file LazyParser.cxx.

◆ LazyParser() [5/6]

LazyParser::LazyParser ( const LazyParser &  rhs,
HeaderFieldValue::CopyPaddingEnum  e 
)

Definition at line 44 of file LazyParser.cxx.

◆ ~LazyParser()

LazyParser::~LazyParser ( )
virtual

Definition at line 50 of file LazyParser.cxx.

◆ LazyParser() [6/6]

LazyParser::LazyParser ( )
protected

Definition at line 33 of file LazyParser.cxx.

Member Function Documentation

◆ checkParsed() [1/2]

void resip::LazyParser::checkParsed ( )
inline

Definition at line 109 of file LazyParser.hxx.

◆ checkParsed() [2/2]

void resip::LazyParser::checkParsed ( ) const
inline

Definition at line 102 of file LazyParser.hxx.

◆ clear()

void LazyParser::clear ( )
protected

Definition at line 99 of file LazyParser.cxx.

◆ doParse()

void LazyParser::doParse ( ) const

Definition at line 73 of file LazyParser.cxx.

◆ encode()

EncodeStream & LazyParser::encode ( EncodeStream &  str) const

Encodes this element to a stream, in the fashion it should be represented on the wire.

Parameters
strThe ostream to encode to.
Returns
A reference to str.

Definition at line 105 of file LazyParser.cxx.

◆ encodeParsed()

◆ errorContext()

virtual const Data & resip::LazyParser::errorContext ( ) const
protectedpure virtual

◆ getHeaderField()

HeaderFieldValue & resip::LazyParser::getHeaderField ( )
inline

Definition at line 96 of file LazyParser.hxx.

◆ isParsed()

bool resip::LazyParser::isParsed ( ) const
inline

Returns true iff a parse has been attempted.

Note
This means that this will return true if a parse failed earlier.

Definition at line 91 of file LazyParser.hxx.

◆ isWellFormed()

bool LazyParser::isWellFormed ( ) const

Returns true iff this element was parsed successfully, according to the implementation of parse().

App writers are expected to use this extensively, since a failure in the parse-on-access will throw an exception the first time access is made, but nothing will happen on subsequent accesses. (Writing a try/catch block when you try to inspect the members of a subclass will only work as intended if the subclass hasn't been accessed before.)

Definition at line 85 of file LazyParser.cxx.

◆ markDirty()

void resip::LazyParser::markDirty ( ) const
inline

Definition at line 116 of file LazyParser.hxx.

◆ operator=()

LazyParser & LazyParser::operator= ( const LazyParser &  rhs)

Definition at line 56 of file LazyParser.cxx.

◆ parse()

Friends And Related Symbol Documentation

◆ Contents

friend class Contents
friend

Definition at line 140 of file LazyParser.hxx.


The documentation for this class was generated from the following files: