reSIProcate/stack  9694
Public Member Functions | Private Attributes
resip::AttributeHelper Class Reference

#include <SdpContents.hxx>

List of all members.

Public Member Functions

 RESIP_HeapCount (AttributeHelper)
 AttributeHelper ()
 AttributeHelper (const AttributeHelper &rhs)
AttributeHelperoperator= (const AttributeHelper &rhs)
bool exists (const Data &key) const
const std::list< Data > & getValues (const Data &key) const
EncodeStreamencode (EncodeStream &s) const
void parse (ParseBuffer &pb)
void addAttribute (const Data &key, const Data &value=Data::Empty)
void clearAttribute (const Data &key)

Private Attributes

std::list< std::pair< Data,
Data > > 
mAttributeList
HashMap< Data, std::list< Data > > mAttributes

Detailed Description

Definition at line 20 of file SdpContents.hxx.


Constructor & Destructor Documentation

AttributeHelper::AttributeHelper ( )

Definition at line 66 of file SdpContents.cxx.

{
}
AttributeHelper::AttributeHelper ( const AttributeHelper rhs)

Definition at line 60 of file SdpContents.cxx.


Member Function Documentation

void AttributeHelper::addAttribute ( const Data key,
const Data value = Data::Empty 
)

Definition at line 141 of file SdpContents.cxx.

References mAttributeList, and mAttributes.

Referenced by resip::SdpContents::Session::Medium::addAttribute().

{
   mAttributeList.push_back(std::make_pair(key, value));
   mAttributes[key].push_back(value);
}
void AttributeHelper::clearAttribute ( const Data key)

Definition at line 148 of file SdpContents.cxx.

References mAttributeList, and mAttributes.

Referenced by resip::SdpContents::Session::Medium::clearAttribute(), and resip::SdpContents::Session::Medium::codecs().

{
   for (std::list<std::pair<Data, Data> >::iterator i = mAttributeList.begin();
        i != mAttributeList.end(); )
   {
      std::list<std::pair<Data, Data> >::iterator j = i++;
      if (j->first == key)
      {
         mAttributeList.erase(j);
      }
   }
   mAttributes.erase(key);
}
EncodeStream & AttributeHelper::encode ( EncodeStream s) const

Definition at line 99 of file SdpContents.cxx.

References resip::Symbols::COLON, CRLF, and mAttributeList.

Referenced by resip::SdpContents::Session::Medium::encode().

{
   for (std::list<std::pair<Data, Data> >::const_iterator i = mAttributeList.begin();
        i != mAttributeList.end(); ++i)
   {
      s << "a=" << i->first;
      if (!i->second.empty())
      {
         s << Symbols::COLON[0] << i->second;
      }
      s << Symbols::CRLF;
   }  
   return s;
}
bool AttributeHelper::exists ( const Data key) const
const list< Data > & AttributeHelper::getValues ( const Data key) const

Definition at line 88 of file SdpContents.cxx.

References exists(), and mAttributes.

Referenced by resip::SdpContents::Session::Medium::getValues().

{
   if (!exists(key))
   {
      static const list<Data> emptyList;
      return emptyList;
   }
   return mAttributes.find(key)->second;
}

Here is the call graph for this function:

AttributeHelper & AttributeHelper::operator= ( const AttributeHelper rhs)

Definition at line 71 of file SdpContents.cxx.

References mAttributeList, and mAttributes.

{
   if (this != &rhs)
   {
      mAttributeList = rhs.mAttributeList;
      mAttributes = rhs.mAttributes;
   }
   return *this;
}
void AttributeHelper::parse ( ParseBuffer pb)

Definition at line 115 of file SdpContents.cxx.

References resip::Symbols::COLON, resip::Symbols::CRLF, resip::ParseBuffer::data(), resip::ParseBuffer::eof(), resip::Symbols::EQUALS, mAttributeList, mAttributes, resip::ParseBuffer::position(), resip::ParseBuffer::skipChar(), skipEol(), resip::ParseBuffer::skipToOneOf(), and value.

Referenced by resip::SdpContents::Session::Medium::parse().

{
   while (!pb.eof() && *pb.position() == 'a')
   {
      Data key;
      Data value;

      pb.skipChar('a');
      const char* anchor = pb.skipChar(Symbols::EQUALS[0]);
      pb.skipToOneOf(Symbols::COLON, Symbols::CRLF);
      pb.data(key, anchor);
      if (!pb.eof() && *pb.position() == Symbols::COLON[0])
      {
         anchor = pb.skipChar(Symbols::COLON[0]);
         pb.skipToOneOf(Symbols::CRLF);
         pb.data(value, anchor);
      }

      if(!pb.eof()) skipEol(pb);

      mAttributeList.push_back(std::make_pair(key, value));
      mAttributes[key].push_back(value);
   }
}

Here is the call graph for this function:

resip::AttributeHelper::RESIP_HeapCount ( AttributeHelper  )

Member Data Documentation

std::list<std::pair<Data, Data> > resip::AttributeHelper::mAttributeList [private]

Definition at line 35 of file SdpContents.hxx.

Referenced by addAttribute(), clearAttribute(), encode(), operator=(), and parse().

Definition at line 36 of file SdpContents.hxx.

Referenced by addAttribute(), clearAttribute(), exists(), getValues(), operator=(), and parse().


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