reSIProcate/stack  9694
Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes
resip::HeaderFieldValueList Class Reference

#include <HeaderFieldValueList.hxx>

Collaboration diagram for resip::HeaderFieldValueList:
Collaboration graph
[legend]

List of all members.

Public Types

typedef ListImpl::iterator iterator
typedef ListImpl::const_iterator const_iterator

Public Member Functions

 HeaderFieldValueList ()
 HeaderFieldValueList (PoolBase &pool)
 ~HeaderFieldValueList ()
 HeaderFieldValueList (const HeaderFieldValueList &rhs)
 HeaderFieldValueList (const HeaderFieldValueList &rhs, PoolBase &pool)
HeaderFieldValueListoperator= (const HeaderFieldValueList &rhs)
void setParserContainer (ParserContainerBase *parser)
ParserContainerBasegetParserContainer () const
EncodeStreamencode (int headerEnum, EncodeStream &str) const
EncodeStreamencode (const Data &headerName, EncodeStream &str) const
EncodeStreamencodeEmbedded (const Data &headerName, EncodeStream &str) const
bool empty () const
size_t size () const
void clear ()
void push_back (const char *buffer, size_t length, bool own)
 READ THIS CAREFULLY BEFORE USING THIS FUNCTION.
void pop_back ()
HeaderFieldValuefront ()
HeaderFieldValueback ()
const HeaderFieldValuefront () const
const HeaderFieldValueback () const
void reserve (size_t size)
bool parsedEmpty () const
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const

Static Public Attributes

static const HeaderFieldValueList Empty

Private Types

typedef std::vector
< HeaderFieldValue,
StlPoolAllocator
< HeaderFieldValue, PoolBase > > 
ListImpl

Private Member Functions

void freeParserContainer ()

Private Attributes

ListImpl mHeaders
PoolBasemPool
ParserContainerBasemParserContainer

Detailed Description

Definition at line 20 of file HeaderFieldValueList.hxx.


Member Typedef Documentation

typedef ListImpl::const_iterator resip::HeaderFieldValueList::const_iterator

Definition at line 89 of file HeaderFieldValueList.hxx.

typedef ListImpl::iterator resip::HeaderFieldValueList::iterator

Definition at line 88 of file HeaderFieldValueList.hxx.

Definition at line 86 of file HeaderFieldValueList.hxx.


Constructor & Destructor Documentation

resip::HeaderFieldValueList::HeaderFieldValueList ( ) [inline]

Definition at line 25 of file HeaderFieldValueList.hxx.

resip::HeaderFieldValueList::HeaderFieldValueList ( PoolBase pool) [inline]

Definition at line 31 of file HeaderFieldValueList.hxx.

         : mHeaders(StlPoolAllocator<HeaderFieldValue, PoolBase>(&pool)),
           mPool(&pool),
           mParserContainer(0)
      {}
HeaderFieldValueList::~HeaderFieldValueList ( )

Definition at line 18 of file HeaderFieldValueList.cxx.

References freeParserContainer().

Referenced by resip::SipMessage::freeHfvl().

Here is the call graph for this function:

HeaderFieldValueList::HeaderFieldValueList ( const HeaderFieldValueList rhs)

Definition at line 23 of file HeaderFieldValueList.cxx.

References resip::ParserContainerBase::clone(), mHeaders, and mParserContainer.

   : mHeaders(),
     mPool(0),
     mParserContainer(0)
{
   if (rhs.mParserContainer)
   {
      mParserContainer = rhs.mParserContainer->clone();
   }
   else if(rhs.mHeaders.size())
   {
      mHeaders=rhs.mHeaders;
   }
}

Here is the call graph for this function:

HeaderFieldValueList::HeaderFieldValueList ( const HeaderFieldValueList rhs,
PoolBase pool 
)

Definition at line 38 of file HeaderFieldValueList.cxx.

References resip::ParserContainerBase::clone(), mHeaders, and mParserContainer.

Here is the call graph for this function:


Member Function Documentation

HeaderFieldValue* resip::HeaderFieldValueList::back ( ) [inline]

Definition at line 75 of file HeaderFieldValueList.hxx.

References mHeaders.

{return &mHeaders.back();}
const HeaderFieldValue* resip::HeaderFieldValueList::back ( ) const [inline]

Definition at line 77 of file HeaderFieldValueList.hxx.

References mHeaders.

{return &mHeaders.back();}
iterator resip::HeaderFieldValueList::begin ( ) [inline]

Definition at line 91 of file HeaderFieldValueList.hxx.

References mHeaders.

Referenced by encode(), encodeEmbedded(), and resip::ParserContainer< NameAddr >::ParserContainer().

{return mHeaders.begin();}
const_iterator resip::HeaderFieldValueList::begin ( ) const [inline]

Definition at line 93 of file HeaderFieldValueList.hxx.

References mHeaders.

{return mHeaders.begin();}
void HeaderFieldValueList::clear ( void  )

Definition at line 176 of file HeaderFieldValueList.cxx.

References freeParserContainer(), and mHeaders.

{
   freeParserContainer();
   mHeaders.clear();
}

Here is the call graph for this function:

bool resip::HeaderFieldValueList::empty ( ) const [inline]

Definition at line 49 of file HeaderFieldValueList.hxx.

References mHeaders.

{return mHeaders.empty();}
EncodeStream & HeaderFieldValueList::encode ( int  headerEnum,
EncodeStream str 
) const

Definition at line 76 of file HeaderFieldValueList.cxx.

References begin(), resip::Symbols::COLON, resip::Symbols::COMMA, resip::Symbols::CRLF, CRLF, resip::Data::empty(), resip::ParserContainerBase::encode(), end(), resip::Headers::getHeaderName(), getParserContainer(), resip::Headers::isCommaEncoding(), and resip::Symbols::SPACE.

Referenced by encodeEmbedded().

{
   const Data& headerName = Headers::getHeaderName(static_cast<Headers::Type>(headerEnum));

   if (getParserContainer() != 0)
   {
      getParserContainer()->encode(headerName, str);
   }
   else
   {
      if (!headerName.empty())
      {
         str << headerName << Symbols::COLON[0] << Symbols::SPACE[0];
      }

      for (HeaderFieldValueList::const_iterator j = begin();
           j != end(); j++)
      {
         if (j != begin())
         {
            if (Headers::isCommaEncoding(static_cast<Headers::Type>(headerEnum)))
            {
               str << Symbols::COMMA[0] << Symbols::SPACE[0];
            }
            else
            {
               str << Symbols::CRLF << headerName << Symbols::COLON << Symbols::SPACE;
            }
         }
         j->encode(str);
      }
      str << Symbols::CRLF;
   }
   return str;
}

Here is the call graph for this function:

EncodeStream & HeaderFieldValueList::encode ( const Data headerName,
EncodeStream str 
) const

Definition at line 113 of file HeaderFieldValueList.cxx.

References begin(), resip::Symbols::COLON, resip::Symbols::COMMA, CRLF, resip::Data::empty(), resip::ParserContainerBase::encode(), end(), getParserContainer(), and resip::Symbols::SPACE.

{
   if (getParserContainer() != 0)
   {
      getParserContainer()->encode(headerName, str);
   }
   else
   {
      if (!headerName.empty())
      {
         str << headerName << Symbols::COLON << Symbols::SPACE;
      }
      for (HeaderFieldValueList::const_iterator j = begin();
           j != end(); j++)
      {
         if (j != begin())
         {
            str << Symbols::COMMA[0] << Symbols::SPACE[0];
         }
         j->encode(str);
      }
      str << Symbols::CRLF;
   }
   return str;
}

Here is the call graph for this function:

EncodeStream & HeaderFieldValueList::encodeEmbedded ( const Data headerName,
EncodeStream str 
) const

Definition at line 140 of file HeaderFieldValueList.cxx.

References resip::Symbols::AMPERSAND, begin(), resip::Data::empty(), encode(), resip::ParserContainerBase::encodeEmbedded(), end(), resip::Symbols::EQUALS, and getParserContainer().

{
  assert(!headerName.empty());

   if (getParserContainer() != 0)
   {
      getParserContainer()->encodeEmbedded(headerName, str);
   }
   else
   {
      bool first = true;
      for (HeaderFieldValueList::const_iterator j = begin();
           j != end(); j++)
      {
         if (first)
         {
            first = false;
         }
         else
         {
            str << Symbols::AMPERSAND;
         }

         str << headerName << Symbols::EQUALS;
         Data buf;
         {
            DataStream s(buf);
            j->encode(s);
         }
         str << Embedded::encode(buf);
      }
   }
   return str;
}

Here is the call graph for this function:

iterator resip::HeaderFieldValueList::end ( ) [inline]

Definition at line 92 of file HeaderFieldValueList.hxx.

References mHeaders.

Referenced by encode(), encodeEmbedded(), and resip::ParserContainer< NameAddr >::ParserContainer().

{return mHeaders.end();}
const_iterator resip::HeaderFieldValueList::end ( ) const [inline]

Definition at line 94 of file HeaderFieldValueList.hxx.

References mHeaders.

{return mHeaders.end();}
void HeaderFieldValueList::freeParserContainer ( ) [private]

Definition at line 196 of file HeaderFieldValueList.cxx.

References resip::PoolBase::deallocate(), mParserContainer, mPool, and resip::ParserContainerBase::~ParserContainerBase().

Referenced by clear(), operator=(), and ~HeaderFieldValueList().

{
   if(mParserContainer)
   {
      mParserContainer->~ParserContainerBase();
      // The allocator will check whether this belongs to it, and if not, fall 
      // back to global operator delete.
      if(mPool)
      {
         mPool->deallocate(mParserContainer);
      }
      else
      {
         ::operator delete(mParserContainer);
      }
      mParserContainer=0;
   }
}

Here is the call graph for this function:

HeaderFieldValue* resip::HeaderFieldValueList::front ( ) [inline]

Definition at line 74 of file HeaderFieldValueList.hxx.

References mHeaders.

{return &mHeaders.front();}
const HeaderFieldValue* resip::HeaderFieldValueList::front ( ) const [inline]

Definition at line 76 of file HeaderFieldValueList.hxx.

References mHeaders.

{return &mHeaders.front();}
ParserContainerBase* resip::HeaderFieldValueList::getParserContainer ( ) const [inline]
HeaderFieldValueList & HeaderFieldValueList::operator= ( const HeaderFieldValueList rhs)

Definition at line 54 of file HeaderFieldValueList.cxx.

References resip::ParserContainerBase::clone(), freeParserContainer(), mHeaders, and mParserContainer.

{
   if(this!=&rhs)
   {
      mHeaders.clear();

      freeParserContainer();

      if (rhs.mParserContainer != 0)
      {
         mParserContainer = rhs.mParserContainer->clone();
      }
      else
      {
         mHeaders=rhs.mHeaders;
      }
   }
   
   return *this;
}

Here is the call graph for this function:

bool HeaderFieldValueList::parsedEmpty ( ) const

Definition at line 183 of file HeaderFieldValueList.cxx.

References resip::ParserContainerBase::empty(), mHeaders, and mParserContainer.

Referenced by resip::SipMessage::parseAllHeaders(), and resip::SipMessage::setRawHeader().

{
   if (mParserContainer)
   {
      return mParserContainer->empty();
   }
   else
   {
      return mHeaders.empty();
   }
}

Here is the call graph for this function:

void resip::HeaderFieldValueList::pop_back ( ) [inline]

Definition at line 73 of file HeaderFieldValueList.hxx.

References mHeaders.

{mHeaders.pop_back();};
void resip::HeaderFieldValueList::push_back ( const char *  buffer,
size_t  length,
bool  own 
) [inline]

READ THIS CAREFULLY BEFORE USING THIS FUNCTION.

Parameters:
ownSpecifies whether the created HeaderFieldValue will take ownership of the buffer passed. This will never make a copy of the buffer; if own==false, the HeaderFieldValue will retain the same reference that it would if own==true. The only difference is that if own==false, the buffer will not be deleted when the HeaderFieldValue goes away/releases its reference, while if own==true the buffer will be deleted. This means that no matter what you pass for this param, you must ensure that the buffer is not deleted during the lifetime of this HeaderFieldValueList.

Definition at line 66 of file HeaderFieldValueList.hxx.

References resip::HeaderFieldValue::Empty, and mHeaders.

Referenced by resip::SipMessage::addHeader(), resip::SipMessage::ensureHeader(), resip::SipMessage::parseAllHeaders(), and resip::SipMessage::setRawHeader().

      {
         mHeaders.push_back(HeaderFieldValue::Empty); 
         mHeaders.back().init(buffer,length,own);
      }
void resip::HeaderFieldValueList::reserve ( size_t  size) [inline]

Definition at line 79 of file HeaderFieldValueList.hxx.

References mHeaders.

      {
         mHeaders.reserve(size);
      }
void resip::HeaderFieldValueList::setParserContainer ( ParserContainerBase parser) [inline]
size_t resip::HeaderFieldValueList::size ( ) const [inline]

Definition at line 50 of file HeaderFieldValueList.hxx.

References mHeaders.

Referenced by resip::SipMessage::addHeader(), and resip::ParserContainer< NameAddr >::ParserContainer().

{return mHeaders.size();}

Member Data Documentation

Definition at line 23 of file HeaderFieldValueList.hxx.

Definition at line 98 of file HeaderFieldValueList.hxx.

Referenced by freeParserContainer().


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