|
reSIProcate/stack
9694
|
Abstract Base class implemented in derived class ParserContainer. More...
#include <ParserContainerBase.hxx>


Classes | |
| class | HeaderKit |
Public Types | |
| typedef size_t | size_type |
Public Member Functions | |
| ParserContainerBase (Headers::Type type=Headers::UNKNOWN) | |
| constructor; sets the type only | |
| ParserContainerBase (Headers::Type type, PoolBase &pool) | |
| constructor; sets the type only | |
| ParserContainerBase (const ParserContainerBase &rhs) | |
| copy constructor copies the mType and the mParsers from the rhs | |
| ParserContainerBase (const ParserContainerBase &rhs, PoolBase &pool) | |
| ParserContainerBase & | operator= (const ParserContainerBase &rhs) |
| assignment operator copies the mParsers from the rhs | |
| virtual | ~ParserContainerBase () |
| virtual destructor - empty in this class | |
| void | clear () |
| clear the mParsers vector | |
| virtual ParserContainerBase * | clone () const =0 |
| pure virtual function to be implemented in derived classes with the intention of cloning this object | |
| size_t | size () const |
| return the size of the mParsers vector | |
| bool | empty () const |
| return true or false indicating whether the mParsers vector is empty or not | |
| EncodeStream & | encode (const Data &headerName, EncodeStream &str) const |
| the actual mechanics of parsing | |
| std::ostream & | encode (Headers::Type type, std::ostream &str) const |
| the actual mechanics of parsing | |
| EncodeStream & | encodeEmbedded (const Data &headerName, EncodeStream &str) const |
| the actual mechanics of parsing | |
| void | pop_front () |
| if mParsers vector is not empty, erase the first element | |
| void | pop_back () |
| if mParsers vector is not empty, erase the first element | |
| void | append (const ParserContainerBase &rhs) |
| append the vector to the mParsers vector held locally | |
| virtual void | parseAll ()=0 |
| pure virtual function to be implemented in derived classes The intention is to provide an ability to parse all elements in the mParsers vector. | |
Protected Types | |
| typedef std::vector< HeaderKit, StlPoolAllocator< HeaderKit, PoolBase > > | Parsers |
Protected Member Functions | |
| void | copyParsers (const Parsers &parsers) |
| copy header kits | |
| void | freeParsers () |
| free parser containers | |
| void | freeParser (HeaderKit &kit) |
| ParserCategory * | makeParser (const ParserCategory &orig) |
Protected Attributes | |
| const Headers::Type | mType |
| Parsers | mParsers |
| the actual list (vector) of parsers on which encoding is done | |
| PoolBase * | mPool |
Abstract Base class implemented in derived class ParserContainer.
Definition at line 22 of file ParserContainerBase.hxx.
typedef std::vector<HeaderKit, StlPoolAllocator<HeaderKit, PoolBase> > resip::ParserContainerBase::Parsers [protected] |
Reimplemented in resip::ParserContainer< T >, and resip::ParserContainer< NameAddr >.
Definition at line 171 of file ParserContainerBase.hxx.
| typedef size_t resip::ParserContainerBase::size_type |
Definition at line 25 of file ParserContainerBase.hxx.
| ParserContainerBase::ParserContainerBase | ( | Headers::Type | type = Headers::UNKNOWN | ) |
constructor; sets the type only
Definition at line 11 of file ParserContainerBase.cxx.
| ParserContainerBase::ParserContainerBase | ( | Headers::Type | type, |
| PoolBase & | pool | ||
| ) |
constructor; sets the type only
Definition at line 24 of file ParserContainerBase.cxx.
: mType(type), mParsers(StlPoolAllocator<HeaderKit, PoolBase>(&pool)), mPool(&pool) {}
| ParserContainerBase::ParserContainerBase | ( | const ParserContainerBase & | rhs | ) |
copy constructor copies the mType and the mParsers from the rhs
Definition at line 16 of file ParserContainerBase.cxx.
References copyParsers(), and mParsers.

| ParserContainerBase::ParserContainerBase | ( | const ParserContainerBase & | rhs, |
| PoolBase & | pool | ||
| ) |
Definition at line 31 of file ParserContainerBase.cxx.
References copyParsers(), and mParsers.
: mType(rhs.mType), mParsers(StlPoolAllocator<HeaderKit, PoolBase>(&pool)), mPool(&pool) { copyParsers(rhs.mParsers); }

| ParserContainerBase::~ParserContainerBase | ( | ) | [virtual] |
virtual destructor - empty in this class
Definition at line 40 of file ParserContainerBase.cxx.
References freeParsers().
Referenced by resip::HeaderFieldValueList::freeParserContainer().
{
freeParsers();
}

| void ParserContainerBase::append | ( | const ParserContainerBase & | rhs | ) |
append the vector to the mParsers vector held locally
| rhs | is the vector whose elements will be added to the local mParsers vector |
Definition at line 74 of file ParserContainerBase.cxx.
References copyParsers(), and mParsers.
Referenced by resip::Helper::authenticateRequest(), and resip::Helper::authenticateRequestWithA1().
{
copyParsers(source.mParsers);
}

| void resip::ParserContainerBase::clear | ( | void | ) | [inline] |
clear the mParsers vector
Definition at line 61 of file ParserContainerBase.hxx.
References mParsers.
Referenced by resip::DeprecatedDialog::clear().
{mParsers.clear();}
| virtual ParserContainerBase* resip::ParserContainerBase::clone | ( | ) | const [pure virtual] |
pure virtual function to be implemented in derived classes with the intention of cloning this object
Implemented in resip::ParserContainer< T >, and resip::ParserContainer< NameAddr >.
Referenced by resip::HeaderFieldValueList::HeaderFieldValueList(), and resip::HeaderFieldValueList::operator=().
| void ParserContainerBase::copyParsers | ( | const Parsers & | parsers | ) | [protected] |
copy header kits
Definition at line 152 of file ParserContainerBase.cxx.
References makeParser(), mParsers, and resip::ParserContainerBase::HeaderKit::pc.
Referenced by append(), operator=(), and ParserContainerBase().
{
mParsers.reserve(mParsers.size() + parsers.size());
for(Parsers::const_iterator p=parsers.begin(); p!=parsers.end(); ++p)
{
mParsers.push_back(*p);
HeaderKit& kit(mParsers.back());
if(kit.pc)
{
kit.pc = makeParser(*kit.pc);
}
}
}

| bool resip::ParserContainerBase::empty | ( | ) | const [inline] |
return true or false indicating whether the mParsers vector is empty or not
Definition at line 78 of file ParserContainerBase.hxx.
References mParsers.
Referenced by resip::Helper::authenticateRequest(), resip::Helper::authenticateRequestWithA1(), and resip::HeaderFieldValueList::parsedEmpty().
{return mParsers.empty();}
| EncodeStream & ParserContainerBase::encode | ( | const Data & | headerName, |
| EncodeStream & | str | ||
| ) | const |
the actual mechanics of parsing
Definition at line 80 of file ParserContainerBase.cxx.
References resip::Symbols::COLON, resip::Symbols::COMMA, resip::Symbols::CRLF, CRLF, resip::Data::empty(), resip::Headers::isCommaEncoding(), mParsers, mType, and resip::Symbols::SPACE.
Referenced by resip::HeaderFieldValueList::encode(), and encodeEmbedded().
{
// !jf! this is not strictly correct since some headers are allowed to
// be empty: Supported, Accept-Encoding, Allow-Events, Allow,
// Accept,Accept-Language
if (!mParsers.empty())
{
if (!headerName.empty())
{
str << headerName << Symbols::COLON[0] << Symbols::SPACE[0];
}
for (Parsers::const_iterator i = mParsers.begin();
i != mParsers.end(); ++i)
{
if (i != mParsers.begin())
{
if (Headers::isCommaEncoding(mType))
{
str << Symbols::COMMA[0] << Symbols::SPACE[0];
}
else
{
str << Symbols::CRLF << headerName << Symbols::COLON[0] << Symbols::SPACE[0];
}
}
i->encode(str);
}
str << Symbols::CRLF;
}
return str;
}

| std::ostream& resip::ParserContainerBase::encode | ( | Headers::Type | type, |
| std::ostream & | str | ||
| ) | const |
the actual mechanics of parsing
| EncodeStream & ParserContainerBase::encodeEmbedded | ( | const Data & | headerName, |
| EncodeStream & | str | ||
| ) | const |
the actual mechanics of parsing
Definition at line 118 of file ParserContainerBase.cxx.
References resip::Symbols::AMPERSAND, resip::Data::empty(), encode(), resip::Symbols::EQUALS, and mParsers.
Referenced by resip::HeaderFieldValueList::encodeEmbedded().
{
assert(!headerName.empty());
if (!mParsers.empty())
{
bool first = true;
for (Parsers::const_iterator i = mParsers.begin();
i != mParsers.end(); ++i)
{
if (first)
{
first = false;
}
else
{
str << Symbols::AMPERSAND;
}
str << headerName << Symbols::EQUALS;
Data buf;
{
DataStream s(buf);
i->encode(s);
}
str << Embedded::encode(buf);
}
}
return str;
}

| void resip::ParserContainerBase::freeParser | ( | HeaderKit & | kit | ) | [inline, protected] |
Definition at line 188 of file ParserContainerBase.hxx.
References resip::PoolBase::deallocate(), mPool, resip::ParserContainerBase::HeaderKit::pc, and resip::ParserCategory::~ParserCategory().
Referenced by resip::ParserContainer< NameAddr >::erase(), freeParsers(), pop_back(), and pop_front().
{
if(kit.pc)
{
kit.pc->~ParserCategory();
if(mPool)
{
mPool->deallocate(kit.pc);
}
else
{
::operator delete(kit.pc);
}
kit.pc=0;
}
}

| void ParserContainerBase::freeParsers | ( | ) | [protected] |
free parser containers
Definition at line 167 of file ParserContainerBase.cxx.
References freeParser(), and mParsers.
Referenced by operator=(), and ~ParserContainerBase().
{
for(Parsers::iterator p=mParsers.begin(); p!=mParsers.end(); ++p)
{
freeParser(*p);
}
}

| ParserCategory* resip::ParserContainerBase::makeParser | ( | const ParserCategory & | orig | ) | [inline, protected] |
Definition at line 205 of file ParserContainerBase.hxx.
References resip::ParserCategory::clone(), and mPool.
Referenced by copyParsers(), resip::ParserContainer< NameAddr >::push_back(), and resip::ParserContainer< NameAddr >::push_front().
{
return orig.clone(mPool);
}

| ParserContainerBase & ParserContainerBase::operator= | ( | const ParserContainerBase & | rhs | ) |
assignment operator copies the mParsers from the rhs
Definition at line 46 of file ParserContainerBase.cxx.
References copyParsers(), freeParsers(), and mParsers.
{
if (this != &rhs)
{
freeParsers();
mParsers.clear();
copyParsers(rhs.mParsers);
}
return *this;
}

| virtual void resip::ParserContainerBase::parseAll | ( | ) | [pure virtual] |
pure virtual function to be implemented in derived classes The intention is to provide an ability to parse all elements in the mParsers vector.
Implemented in resip::ParserContainer< T >, and resip::ParserContainer< NameAddr >.
Referenced by resip::SipMessage::parseAllHeaders().
| void ParserContainerBase::pop_back | ( | ) |
if mParsers vector is not empty, erase the first element
Definition at line 66 of file ParserContainerBase.cxx.
References freeParser(), and mParsers.
{
assert(!mParsers.empty());
freeParser(mParsers.back());
mParsers.pop_back();
}

| void ParserContainerBase::pop_front | ( | ) |
if mParsers vector is not empty, erase the first element
Definition at line 58 of file ParserContainerBase.cxx.
References freeParser(), and mParsers.
{
assert(!mParsers.empty());
freeParser(mParsers.front());
mParsers.erase(mParsers.begin());
}

| size_t resip::ParserContainerBase::size | ( | ) | const [inline] |
return the size of the mParsers vector
Definition at line 72 of file ParserContainerBase.hxx.
References mParsers.
Referenced by main(), and resip::TuIM::processRegisterRequest().
{return mParsers.size();}
Parsers resip::ParserContainerBase::mParsers [protected] |
the actual list (vector) of parsers on which encoding is done
Definition at line 175 of file ParserContainerBase.hxx.
Referenced by append(), resip::ParserContainer< NameAddr >::back(), resip::ParserContainer< NameAddr >::begin(), clear(), copyParsers(), empty(), encode(), encodeEmbedded(), resip::ParserContainer< NameAddr >::end(), resip::ParserContainer< NameAddr >::erase(), resip::ParserContainer< NameAddr >::find(), freeParsers(), resip::ParserContainer< NameAddr >::front(), operator=(), resip::ParserContainer< NameAddr >::parseAll(), resip::ParserContainer< NameAddr >::ParserContainer(), ParserContainerBase(), pop_back(), pop_front(), resip::ParserContainer< NameAddr >::push_back(), resip::ParserContainer< NameAddr >::push_front(), resip::ParserContainer< NameAddr >::reverse(), and size().
PoolBase* resip::ParserContainerBase::mPool [protected] |
Definition at line 176 of file ParserContainerBase.hxx.
Referenced by resip::ParserContainer< NameAddr >::ensureInitialized(), freeParser(), and makeParser().
const Headers::Type resip::ParserContainerBase::mType [protected] |
Definition at line 125 of file ParserContainerBase.hxx.
Referenced by encode(), and resip::ParserContainer< NameAddr >::ensureInitialized().
1.7.5.1