1#ifndef RESIP_ParserContainer_hxx
2#define RESIP_ParserContainer_hxx
54 i != hfvs->
end(); i++)
58 mParsers.push_back(HeaderKit::Empty);
59 mParsers.back().hfv.init(i->getBuffer(),i->getLength(),
false);
70 i != hfvs->
end(); i++)
74 mParsers.push_back(HeaderKit::Empty);
75 mParsers.back().hfv.init(i->getBuffer(),i->getLength(),
false);
106 return ensureInitialized(
mParsers.front(),
this);
114 return ensureInitialized(
mParsers.back(),
this);
122 return ensureInitialized(
mParsers.front(),
this);
130 return ensureInitialized(
mParsers.back(),
this);
139 if (index >=
mParsers.size())
return nullptr;
140 return &ensureInitialized(
mParsers[index],
this);
145 if (index >=
mParsers.size())
return nullptr;
146 return &ensureInitialized(
mParsers[index],
this);
163 mParsers.push_back(HeaderKit::Empty);
216 typename Parsers::iterator mIt;
260 const T&
operator*() {
return ensureInitialized(*mIt,mRef);}
261 const T*
operator->() {
return &ensureInitialized(*mIt,mRef);}
264 typename Parsers::const_iterator mIt;
293 for (
typename Parsers::const_iterator
i =
mParsers.begin();
297 if (
rhs.isEqual(ensureInitialized(*
i,
this)))
312 for (
typename Parsers::const_iterator
i =
mParsers.begin();
315 ensureInitialized(*
i,
this).checkParsed();
346 static T& ensureInitialized(HeaderKit& kit, ParserContainer* ref)
353 kit.pc=
new (pool) T(kit.hfv, ref->mType, pool);
360 return *
static_cast<T*
>(kit.pc);
363 static const T& ensureInitialized(
const HeaderKit& kit,
368 HeaderKit& nc_kit(
const_cast<HeaderKit&
>(kit));
373 nc_kit.pc=
new (pool) T(kit.hfv, ref->
mType, pool);
380 return *
static_cast<T*
>(kit.pc);
389 for (
typename resip::ParserContainer <T>::const_iterator i = c.
begin();
Abstract Base class implemented in derived class ParserContainer.
std::vector< HeaderKit, StlPoolAllocator< HeaderKit, PoolBase > > Parsers
const Headers::Type mType
ParserCategory * makeParser(const ParserCategory &orig)
ParserContainerBase & operator=(const ParserContainerBase &rhs)
assignment operator copies the mParsers from the rhs
Parsers mParsers
the actual list (vector) of parsers on which encoding is done
void freeParser(HeaderKit &kit)
A const_iterator class (bidirectional)
const_iterator operator--()
friend bool operator!=(const const_iterator &lhs, const const_iterator &rhs)
const_iterator operator--(int)
const_iterator(Parsers::const_iterator i, const ParserContainer *ref)
const_iterator & operator=(const iterator &rhs)
std::bidirectional_iterator_tag iterator_category
friend bool operator==(const const_iterator &lhs, const const_iterator &rhs)
const_iterator operator++(int)
std::ptrdiff_t difference_type
const_iterator operator++()
const_iterator(const iterator &orig)
const_iterator & operator=(const const_iterator &rhs)
const_iterator(const const_iterator &orig)
An iterator class (bidirectional)
std::bidirectional_iterator_tag iterator_category
friend bool operator==(const iterator &lhs, const iterator &rhs)
std::ptrdiff_t difference_type
iterator & operator=(const iterator &rhs)
iterator(typename Parsers::iterator i, ParserContainer *ref)
iterator(const iterator &orig)
friend bool operator!=(const iterator &lhs, const iterator &rhs)
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
ParserContainer(const ParserContainer &other)
Copy c'tor.
const value_type & const_reference
ParserContainer reverse() const
Returns a copy of this ParserContainer, in reverse order.
iterator end()
Returns an iterator pointing to the last header field value.
T & back()
Returns the last header field value in this container.
ParserContainer & operator=(const ParserContainer &other)
Assignment operator.
ParserContainer(PoolBase &pool)
T & front()
Returns the first header field value in this container.
virtual void parseAll()
Triggers a parse of all contained header field values.
const T & back() const
Returns the last header field value in this container.
virtual ParserContainerBase * clone() const
Clones this container, and all contained header field values.
ParserContainer(HeaderFieldValueList *hfvs, Headers::Type type, PoolBase &pool)
const_iterator end() const
Returns a const_iterator pointing to the first header field value.
T * getByIndex(size_t index)
Returns a pointer to the header field value at the given 0-based index, or nullptr if the index is ou...
iterator erase(iterator i)
Erases the header field value pointed to by i.
ParserContainer()
Default c'tor.
ParserContainerBase::Parsers Parsers
iterator begin()
Returns an iterator pointing to the first header field value.
void push_front(const T &t)
Inserts a header field value at the front of this container.
ParserContainer(HeaderFieldValueList *hfvs, Headers::Type type=Headers::UNKNOWN)
ParserContainer(const ParserContainer &other, PoolBase &pool)
Copy c'tor.
const value_type * const_pointer
const T * getByIndex(size_t index) const
void push_back(const T &t)
Inserts a header field value at the back of this container.
const_iterator begin() const
Returns a const_iterator pointing to the first header field value.
const T & front() const
Returns the first header field value in this container.
bool find(const T &rhs) const
Finds the first header field value that matches rhs.
ptrdiff_t difference_type
dcm! – add UnusedChecking(_enum) below;
EncodeStream & insert(EncodeStream &s, const std::vector< T > &c)
Completely generic insert function.