|
reSIProcate/stack
9694
|
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact, Via, etc). More...
#include <ParserContainer.hxx>


Classes | |
| class | const_iterator |
| A const_iterator class, derived from std::iterator (bidirectional) More... | |
| class | iterator |
| An iterator class, derived from std::iterator (bidirectional) More... | |
Public Types | |
| typedef T | value_type |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef ptrdiff_t | difference_type |
| typedef ParserContainerBase::Parsers | Parsers |
Public Member Functions | |
| ParserContainer () | |
| Default c'tor. | |
| ParserContainer (PoolBase &pool) | |
| ParserContainer (HeaderFieldValueList *hfvs, Headers::Type type=Headers::UNKNOWN) | |
| Used by SipMessage (using this carries a high risk of blowing your feet off). | |
| ParserContainer (HeaderFieldValueList *hfvs, Headers::Type type, PoolBase &pool) | |
| ParserContainer (const ParserContainer &other) | |
| Copy c'tor. | |
| ParserContainer (const ParserContainer &other, PoolBase &pool) | |
| Copy c'tor. | |
| ParserContainer & | operator= (const ParserContainer &other) |
| Assignment operator. | |
| T & | front () |
| Returns the first header field value in this container. | |
| T & | back () |
| Returns the last header field value in this container. | |
| const T & | front () const |
| Returns the first header field value in this container. | |
| const T & | back () const |
| Returns the last header field value in this container. | |
| void | push_front (const T &t) |
| Inserts a header field value at the front of this container. | |
| void | push_back (const T &t) |
| Inserts a header field value at the back of this container. | |
| ParserContainer | reverse () const |
| Returns a copy of this ParserContainer, in reverse order. | |
| iterator | begin () |
| Returns an iterator pointing to the first header field value. | |
| iterator | end () |
| Returns an iterator pointing to the last header field value. | |
| iterator | erase (iterator i) |
| Erases the header field value pointed to by i. | |
| bool | find (const T &rhs) const |
| Finds the first header field value that matches rhs. | |
| virtual void | parseAll () |
| Triggers a parse of all contained header field values. | |
| const_iterator | begin () const |
| Returns a const_iterator pointing to the first header field value. | |
| const_iterator | end () const |
| Returns a const_iterator pointing to the first header field value. | |
| virtual ParserContainerBase * | clone () const |
| Clones this container, and all contained header field values. | |
Static Private Member Functions | |
| static T & | ensureInitialized (HeaderKit &kit, ParserContainer *ref) |
| static const T & | ensureInitialized (const HeaderKit &kit, const ParserContainer *ref) |
Friends | |
| class | ParserContainer< T >::iterator |
| class | ParserContainer< T >::const_iterator |
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact, Via, etc).
This has an interface that is similar to stl containers, but not as complete.
Definition at line 22 of file ParserContainer.hxx.
| typedef const value_type* resip::ParserContainer< T >::const_pointer |
Definition at line 27 of file ParserContainer.hxx.
| typedef const value_type& resip::ParserContainer< T >::const_reference |
Definition at line 29 of file ParserContainer.hxx.
| typedef ptrdiff_t resip::ParserContainer< T >::difference_type |
Definition at line 30 of file ParserContainer.hxx.
| typedef ParserContainerBase::Parsers resip::ParserContainer< T >::Parsers |
Reimplemented from resip::ParserContainerBase.
Definition at line 162 of file ParserContainer.hxx.
| typedef value_type* resip::ParserContainer< T >::pointer |
Definition at line 26 of file ParserContainer.hxx.
| typedef value_type& resip::ParserContainer< T >::reference |
Definition at line 28 of file ParserContainer.hxx.
| typedef T resip::ParserContainer< T >::value_type |
Definition at line 25 of file ParserContainer.hxx.
| resip::ParserContainer< T >::ParserContainer | ( | ) | [inline] |
Default c'tor.
Definition at line 35 of file ParserContainer.hxx.
Referenced by resip::ParserContainer< NameAddr >::clone().
| resip::ParserContainer< T >::ParserContainer | ( | PoolBase & | pool | ) | [inline] |
Definition at line 39 of file ParserContainer.hxx.
: ParserContainerBase(Headers::UNKNOWN,pool) {}
| resip::ParserContainer< T >::ParserContainer | ( | HeaderFieldValueList * | hfvs, |
| Headers::Type | type = Headers::UNKNOWN |
||
| ) | [inline] |
Used by SipMessage (using this carries a high risk of blowing your feet off).
Definition at line 48 of file ParserContainer.hxx.
: ParserContainerBase(type) { mParsers.reserve(hfvs->size()); for (HeaderFieldValueList::iterator i = hfvs->begin(); i != hfvs->end(); i++) { // create, store without copying -- // keeps the HeaderFieldValue from reallocating its buffer mParsers.push_back(HeaderKit::Empty); mParsers.back().hfv.init(i->getBuffer(),i->getLength(),false); } }
| resip::ParserContainer< T >::ParserContainer | ( | HeaderFieldValueList * | hfvs, |
| Headers::Type | type, | ||
| PoolBase & | pool | ||
| ) | [inline] |
Definition at line 63 of file ParserContainer.hxx.
: ParserContainerBase(type,pool) { mParsers.reserve(hfvs->size()); for (HeaderFieldValueList::iterator i = hfvs->begin(); i != hfvs->end(); i++) { // create, store without copying -- // keeps the HeaderFieldValue from reallocating its buffer mParsers.push_back(HeaderKit::Empty); mParsers.back().hfv.init(i->getBuffer(),i->getLength(),false); } }
| resip::ParserContainer< T >::ParserContainer | ( | const ParserContainer< T > & | other | ) | [inline] |
| resip::ParserContainer< T >::ParserContainer | ( | const ParserContainer< T > & | other, |
| PoolBase & | pool | ||
| ) | [inline] |
Copy c'tor.
Definition at line 89 of file ParserContainer.hxx.
: ParserContainerBase(other, pool) {}
| T& resip::ParserContainer< T >::back | ( | ) | [inline] |
Returns the last header field value in this container.
Definition at line 112 of file ParserContainer.hxx.
{
return ensureInitialized(mParsers.back(),this);
}
| const T& resip::ParserContainer< T >::back | ( | ) | const [inline] |
Returns the last header field value in this container.
Definition at line 128 of file ParserContainer.hxx.
{
return ensureInitialized(mParsers.back(),this);
}
| iterator resip::ParserContainer< T >::begin | ( | ) | [inline] |
Returns an iterator pointing to the first header field value.
Definition at line 242 of file ParserContainer.hxx.
Referenced by resip::Helper::addAuthorization(), resip::Helper::advancedAuthenticateRequest(), resip::Helper::authenticateRequest(), resip::Helper::authenticateRequestWithA1(), and main().
{ return iterator(mParsers.begin(),this); }
| const_iterator resip::ParserContainer< T >::begin | ( | ) | const [inline] |
Returns a const_iterator pointing to the first header field value.
Definition at line 294 of file ParserContainer.hxx.
{ return const_iterator(mParsers.begin(),this); }
| virtual ParserContainerBase* resip::ParserContainer< T >::clone | ( | ) | const [inline, virtual] |
Clones this container, and all contained header field values.
Implements resip::ParserContainerBase.
Definition at line 305 of file ParserContainer.hxx.
{
return new ParserContainer(*this);
}
| iterator resip::ParserContainer< T >::end | ( | ) | [inline] |
Returns an iterator pointing to the last header field value.
Definition at line 247 of file ParserContainer.hxx.
Referenced by resip::Helper::addAuthorization(), resip::Helper::advancedAuthenticateRequest(), resip::Helper::authenticateRequest(), and resip::Helper::authenticateRequestWithA1().
{ return iterator(mParsers.end(),this); }
| const_iterator resip::ParserContainer< T >::end | ( | ) | const [inline] |
Returns a const_iterator pointing to the first header field value.
Definition at line 300 of file ParserContainer.hxx.
{ return const_iterator(mParsers.end(),this); }
| static T& resip::ParserContainer< T >::ensureInitialized | ( | HeaderKit & | kit, |
| ParserContainer< T > * | ref | ||
| ) | [inline, static, private] |
Definition at line 317 of file ParserContainer.hxx.
Referenced by resip::ParserContainer< NameAddr >::back(), resip::ParserContainer< NameAddr >::find(), resip::ParserContainer< NameAddr >::front(), resip::ParserContainer< T >::iterator::operator*(), resip::ParserContainer< T >::const_iterator::operator*(), resip::ParserContainer< T >::iterator::operator->(), resip::ParserContainer< T >::const_iterator::operator->(), and resip::ParserContainer< NameAddr >::parseAll().
{
if(!kit.pc)
{
if(ref)
{
PoolBase* pool(ref->mPool);
kit.pc=new (pool) T(kit.hfv, ref->mType, pool);
}
else
{
kit.pc=new T(kit.hfv, Headers::NONE);
}
}
return *static_cast<T*>(kit.pc);
}
| static const T& resip::ParserContainer< T >::ensureInitialized | ( | const HeaderKit & | kit, |
| const ParserContainer< T > * | ref | ||
| ) | [inline, static, private] |
Definition at line 334 of file ParserContainer.hxx.
{
if(!kit.pc)
{
HeaderKit& nc_kit(const_cast<HeaderKit&>(kit));
if(ref)
{
ParserContainer* nc_ref(const_cast<ParserContainer*>(ref));
PoolBase* pool(nc_ref->mPool);
nc_kit.pc=new (pool) T(kit.hfv, ref->mType, pool);
}
else
{
nc_kit.pc=new T(kit.hfv, Headers::NONE);
}
}
return *static_cast<T*>(kit.pc);
}
| iterator resip::ParserContainer< T >::erase | ( | iterator | i | ) | [inline] |
Erases the header field value pointed to by i.
Invalidates all existing iterators.
Definition at line 253 of file ParserContainer.hxx.
Referenced by main().
{
freeParser(*i.mIt);
return iterator(mParsers.erase(i.mIt),this);
}
| bool resip::ParserContainer< T >::find | ( | const T & | rhs | ) | const [inline] |
Finds the first header field value that matches rhs.
Definition at line 262 of file ParserContainer.hxx.
Referenced by main().
{
for (typename Parsers::const_iterator i = mParsers.begin();
i != mParsers.end(); ++i)
{
// operator== defined by default, but often not usefully
if (rhs.isEqual(ensureInitialized(*i,this)))
{
return true;
}
}
return false;
}
| T& resip::ParserContainer< T >::front | ( | ) | [inline] |
Returns the first header field value in this container.
Definition at line 104 of file ParserContainer.hxx.
{
return ensureInitialized(mParsers.front(),this);
}
| const T& resip::ParserContainer< T >::front | ( | ) | const [inline] |
Returns the first header field value in this container.
Definition at line 120 of file ParserContainer.hxx.
{
return ensureInitialized(mParsers.front(),this);
}
| ParserContainer& resip::ParserContainer< T >::operator= | ( | const ParserContainer< T > & | other | ) | [inline] |
Assignment operator.
Definition at line 96 of file ParserContainer.hxx.
Referenced by resip::ParserContainer< NameAddr >::operator=().
{
return static_cast<ParserContainer&>(ParserContainerBase::operator=(other));
}
| virtual void resip::ParserContainer< T >::parseAll | ( | ) | [inline, virtual] |
Triggers a parse of all contained header field values.
| ParseException | if any header field value is malformed. |
Implements resip::ParserContainerBase.
Definition at line 281 of file ParserContainer.hxx.
{
for (typename Parsers::const_iterator i = mParsers.begin();
i != mParsers.end(); ++i)
{
ensureInitialized(*i,this).checkParsed();
}
}
| void resip::ParserContainer< T >::push_back | ( | const T & | t | ) | [inline] |
Inserts a header field value at the back of this container.
Definition at line 145 of file ParserContainer.hxx.
Referenced by main().
{
mParsers.push_back(HeaderKit::Empty);
mParsers.back().pc=makeParser(t);
}
| void resip::ParserContainer< T >::push_front | ( | const T & | t | ) | [inline] |
Inserts a header field value at the front of this container.
Definition at line 136 of file ParserContainer.hxx.
{
mParsers.insert(mParsers.begin(), HeaderKit::Empty);
mParsers.front().pc=makeParser(t);
}
| ParserContainer resip::ParserContainer< T >::reverse | ( | ) | const [inline] |
Returns a copy of this ParserContainer, in reverse order.
Definition at line 155 of file ParserContainer.hxx.
Referenced by resip::ParserContainer< NameAddr >::reverse().
{
ParserContainer tmp(*this);
std::reverse(tmp.mParsers.begin(), tmp.mParsers.end());
return tmp;
}
friend class ParserContainer< T >::const_iterator [friend] |
Definition at line 312 of file ParserContainer.hxx.
friend class ParserContainer< T >::iterator [friend] |
Definition at line 311 of file ParserContainer.hxx.
1.7.5.1