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

Provides string-parsing functionality with protection from buffer overflow. More...

#include <ParseBuffer.hxx>

Public Member Functions

 ParseBuffer (const char *buff, size_t len, const Data &errorContext=Data::Empty)
 
 ParseBuffer (const char *buff, const Data &errorContext=Data::Empty)
 
 ParseBuffer (const Data &data, const Data &errorContext=Data::Empty)
 
 ParseBuffer (const ParseBuffer &other)
 
const Data & getContext () const
 
ParseBuffer & operator= (const ParseBuffer &other)
 
void reset (const char *pos)
 
bool eof () const
 
bool bof () const
 
bool valid () const
 
Pointer start () const
 
CurrentPosition position () const
 
Pointer end () const
 
size_t lengthRemaining ()
 
CurrentPosition skipChar ()
 
CurrentPosition skipChar (char c)
 
CurrentPosition skipChars (const char *cs)
 
CurrentPosition skipChars (const Data &cs)
 
CurrentPosition skipNonWhitespace ()
 
CurrentPosition skipWhitespace ()
 
CurrentPosition skipLWS ()
 
CurrentPosition skipToTermCRLF ()
 
CurrentPosition skipToChar (char c)
 
CurrentPosition skipToChars (const char *cs)
 
CurrentPosition skipToChars (const Data &cs)
 
CurrentPosition skipToOneOf (const char *cs)
 
CurrentPosition skipToOneOf (const char *cs1, const char *cs2)
 
CurrentPosition skipToOneOf (const Data &cs)
 
CurrentPosition skipToOneOf (const Data &cs1, const Data &cs2)
 
CurrentPosition skipChars (const std::bitset< 256 > &cs)
 
CurrentPosition skipToOneOf (const std::bitset< 256 > &cs)
 
const char * skipToEndQuote (char quote='"')
 
CurrentPosition skipN (size_t count)
 
CurrentPosition skipToEnd ()
 
const char * skipBackChar ()
 
const char * skipBackWhitespace ()
 
const char * skipBackN (int count)
 
const char * skipBackChar (char c)
 
const char * skipBackToChar (char c)
 
const char * skipBackToOneOf (const char *cs)
 
void assertEof () const
 
void assertNotEof () const
 
void fail (const char *file, unsigned int line, const Data &errmsg=Data::Empty) const
 
void data (Data &data, const char *start) const
 make the passed in data share memory with the buffer (uses Data::Share)
 
Data data (const char *start) const
 
void dataUnescaped (Data &data, const char *start) const
 
int integer ()
 
uint8_t uInt8 ()
 
uint32_t uInt32 ()
 dcm! – merge these, ask about length checks
 
uint64_t uInt64 ()
 
uint64_t unsignedLongLong ()
 
unsigned long unsignedInteger ()
 
float floatVal ()
 
int qVal ()
 

Static Public Member Functions

static bool oneOf (char c, const char *cs)
 
static bool oneOf (char c, const Data &cs)
 

Static Public Attributes

static const char * Whitespace = " \t\r\n"
 
static const char * ParamTerm = ";?"
 

Friends

class ParseBuffer::CurrentPosition
 

Detailed Description

Provides string-parsing functionality with protection from buffer overflow.

Throws ParseException when parse failures occur.

Definition at line 17 of file ParseBuffer.hxx.

Constructor & Destructor Documentation

◆ ParseBuffer() [1/4]

ParseBuffer::ParseBuffer ( const char *  buff,
size_t  len,
const Data &  errorContext = Data::Empty 
)

Definition at line 19 of file ParseBuffer.cxx.

◆ ParseBuffer() [2/4]

ParseBuffer::ParseBuffer ( const char *  buff,
const Data &  errorContext = Data::Empty 
)
explicit

Definition at line 27 of file ParseBuffer.cxx.

◆ ParseBuffer() [3/4]

ParseBuffer::ParseBuffer ( const Data &  data,
const Data &  errorContext = Data::Empty 
)
explicit

Definition at line 35 of file ParseBuffer.cxx.

◆ ParseBuffer() [4/4]

ParseBuffer::ParseBuffer ( const ParseBuffer &  other)

Definition at line 43 of file ParseBuffer.cxx.

Member Function Documentation

◆ assertEof()

void resip::ParseBuffer::assertEof ( ) const
inline

Definition at line 218 of file ParseBuffer.hxx.

◆ assertNotEof()

void resip::ParseBuffer::assertNotEof ( ) const
inline

Definition at line 226 of file ParseBuffer.hxx.

◆ bof()

bool resip::ParseBuffer::bof ( ) const
inline

Definition at line 111 of file ParseBuffer.hxx.

◆ data() [1/2]

Data ParseBuffer::data ( const char *  start) const

Definition at line 648 of file ParseBuffer.cxx.

◆ data() [2/2]

void ParseBuffer::data ( Data &  data,
const char *  start 
) const

make the passed in data share memory with the buffer (uses Data::Share)

Definition at line 530 of file ParseBuffer.cxx.

◆ dataUnescaped()

void ParseBuffer::dataUnescaped ( Data &  data,
const char *  start 
) const

Definition at line 569 of file ParseBuffer.cxx.

◆ end()

Pointer resip::ParseBuffer::end ( ) const
inline

Definition at line 115 of file ParseBuffer.hxx.

◆ eof()

bool resip::ParseBuffer::eof ( ) const
inline

Definition at line 110 of file ParseBuffer.hxx.

◆ fail()

void ParseBuffer::fail ( const char *  file,
unsigned int  line,
const Data &  errmsg = Data::Empty 
) const

Definition at line 979 of file ParseBuffer.cxx.

◆ floatVal()

float ParseBuffer::floatVal ( )

Definition at line 835 of file ParseBuffer.cxx.

◆ getContext()

const Data & resip::ParseBuffer::getContext ( ) const
inline

Definition at line 96 of file ParseBuffer.hxx.

◆ integer()

int ParseBuffer::integer ( )

Definition at line 661 of file ParseBuffer.cxx.

◆ lengthRemaining()

size_t resip::ParseBuffer::lengthRemaining ( )
inline

Definition at line 116 of file ParseBuffer.hxx.

◆ oneOf() [1/2]

bool ParseBuffer::oneOf ( char  c,
const char *  cs 
)
static

Definition at line 315 of file ParseBuffer.cxx.

◆ oneOf() [2/2]

bool ParseBuffer::oneOf ( char  c,
const Data &  cs 
)
static

Definition at line 328 of file ParseBuffer.cxx.

◆ operator=()

ParseBuffer & ParseBuffer::operator= ( const ParseBuffer &  other)

Definition at line 51 of file ParseBuffer.cxx.

◆ position()

CurrentPosition resip::ParseBuffer::position ( ) const
inline

Definition at line 114 of file ParseBuffer.hxx.

◆ qVal()

int ParseBuffer::qVal ( )

Definition at line 867 of file ParseBuffer.cxx.

◆ reset()

void resip::ParseBuffer::reset ( const char *  pos)
inline

Definition at line 100 of file ParseBuffer.hxx.

◆ skipBackChar() [1/2]

const char * ParseBuffer::skipBackChar ( )

Definition at line 442 of file ParseBuffer.cxx.

◆ skipBackChar() [2/2]

const char * ParseBuffer::skipBackChar ( char  c)

Definition at line 482 of file ParseBuffer.cxx.

◆ skipBackN()

const char * resip::ParseBuffer::skipBackN ( int  count)
inline

Definition at line 204 of file ParseBuffer.hxx.

◆ skipBackToChar()

const char * ParseBuffer::skipBackToChar ( char  c)

Definition at line 504 of file ParseBuffer.cxx.

◆ skipBackToOneOf()

const char * ParseBuffer::skipBackToOneOf ( const char *  cs)

Definition at line 517 of file ParseBuffer.cxx.

◆ skipBackWhitespace()

const char * ParseBuffer::skipBackWhitespace ( )

Definition at line 453 of file ParseBuffer.cxx.

◆ skipChar() [1/2]

CurrentPosition resip::ParseBuffer::skipChar ( )
inline

Definition at line 118 of file ParseBuffer.hxx.

◆ skipChar() [2/2]

ParseBuffer::CurrentPosition ParseBuffer::skipChar ( char  c)

Definition at line 64 of file ParseBuffer.cxx.

◆ skipChars() [1/3]

ParseBuffer::CurrentPosition ParseBuffer::skipChars ( const char *  cs)

Definition at line 82 of file ParseBuffer.cxx.

◆ skipChars() [2/3]

ParseBuffer::CurrentPosition ParseBuffer::skipChars ( const Data &  cs)

Definition at line 101 of file ParseBuffer.cxx.

◆ skipChars() [3/3]

CurrentPosition resip::ParseBuffer::skipChars ( const std::bitset< 256 > &  cs)
inline

Definition at line 152 of file ParseBuffer.hxx.

◆ skipLWS()

ParseBuffer::CurrentPosition ParseBuffer::skipLWS ( )

Definition at line 166 of file ParseBuffer.cxx.

◆ skipN()

CurrentPosition resip::ParseBuffer::skipN ( size_t  count)
inline

Definition at line 185 of file ParseBuffer.hxx.

◆ skipNonWhitespace()

ParseBuffer::CurrentPosition ParseBuffer::skipNonWhitespace ( )

Definition at line 120 of file ParseBuffer.cxx.

◆ skipToChar()

CurrentPosition resip::ParseBuffer::skipToChar ( char  c)
inline

Definition at line 135 of file ParseBuffer.hxx.

◆ skipToChars() [1/2]

ParseBuffer::CurrentPosition ParseBuffer::skipToChars ( const char *  cs)

Definition at line 248 of file ParseBuffer.cxx.

◆ skipToChars() [2/2]

ParseBuffer::CurrentPosition ParseBuffer::skipToChars ( const Data &  cs)

Definition at line 278 of file ParseBuffer.cxx.

◆ skipToEnd()

CurrentPosition resip::ParseBuffer::skipToEnd ( )
inline

Definition at line 195 of file ParseBuffer.hxx.

◆ skipToEndQuote()

const char * ParseBuffer::skipToEndQuote ( char  quote = '"')

Definition at line 413 of file ParseBuffer.cxx.

◆ skipToOneOf() [1/5]

ParseBuffer::CurrentPosition ParseBuffer::skipToOneOf ( const char *  cs)

Definition at line 341 of file ParseBuffer.cxx.

◆ skipToOneOf() [2/5]

ParseBuffer::CurrentPosition ParseBuffer::skipToOneOf ( const char *  cs1,
const char *  cs2 
)

Definition at line 358 of file ParseBuffer.cxx.

◆ skipToOneOf() [3/5]

ParseBuffer::CurrentPosition ParseBuffer::skipToOneOf ( const Data &  cs)

Definition at line 377 of file ParseBuffer.cxx.

◆ skipToOneOf() [4/5]

ParseBuffer::CurrentPosition ParseBuffer::skipToOneOf ( const Data &  cs1,
const Data &  cs2 
)

Definition at line 394 of file ParseBuffer.cxx.

◆ skipToOneOf() [5/5]

CurrentPosition resip::ParseBuffer::skipToOneOf ( const std::bitset< 256 > &  cs)
inline

Definition at line 168 of file ParseBuffer.hxx.

◆ skipToTermCRLF()

ParseBuffer::CurrentPosition ParseBuffer::skipToTermCRLF ( )

Definition at line 227 of file ParseBuffer.cxx.

◆ skipWhitespace()

ParseBuffer::CurrentPosition ParseBuffer::skipWhitespace ( )

Definition at line 140 of file ParseBuffer.cxx.

◆ start()

Pointer resip::ParseBuffer::start ( ) const
inline

Definition at line 113 of file ParseBuffer.hxx.

◆ uInt32()

uint32_t ParseBuffer::uInt32 ( )

dcm! – merge these, ask about length checks

Definition at line 746 of file ParseBuffer.cxx.

◆ uInt64()

uint64_t ParseBuffer::uInt64 ( )

Definition at line 787 of file ParseBuffer.cxx.

◆ uInt8()

uint8_t ParseBuffer::uInt8 ( )

Definition at line 720 of file ParseBuffer.cxx.

◆ unsignedInteger()

unsigned long resip::ParseBuffer::unsignedInteger ( )
inline

Definition at line 252 of file ParseBuffer.hxx.

◆ unsignedLongLong()

uint64_t resip::ParseBuffer::unsignedLongLong ( )
inline

Definition at line 251 of file ParseBuffer.hxx.

◆ valid()

bool resip::ParseBuffer::valid ( ) const
inline

Definition at line 112 of file ParseBuffer.hxx.

Friends And Related Symbol Documentation

◆ ParseBuffer::CurrentPosition

friend class ParseBuffer::CurrentPosition
friend

Definition at line 264 of file ParseBuffer.hxx.

Member Data Documentation

◆ ParamTerm

const char * ParseBuffer::ParamTerm = ";?"
static

Definition at line 262 of file ParseBuffer.hxx.

◆ Whitespace

const char * ParseBuffer::Whitespace = " \t\r\n"
static

Definition at line 261 of file ParseBuffer.hxx.


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