reSIProcate/stack  9694
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
resip::ParserCategory Class Reference

Base class for all SIP grammar elements that can have parameters. More...

#include <ParserCategory.hxx>

Inheritance diagram for resip::ParserCategory:
Inheritance graph
[legend]
Collaboration diagram for resip::ParserCategory:
Collaboration graph
[legend]

List of all members.

Classes

class  Exception
 Exception class used by ParserCategory. More...

Public Types

enum  { UnknownParserCategory = -1 }
enum  { NoCommaTokenizing = 0, CommasAllowedOutputMulti = 1, CommasAllowedOutputCommas = 3 }
typedef std::set
< ParameterTypes::Type
ParameterTypeSet

Public Member Functions

 ParserCategory (const HeaderFieldValue &headerFieldValue, Headers::Type type, PoolBase *pool=0)
 Constructor used by SipMessage. Unless you _really_ know what you're doing, don't touch this.
 ParserCategory (const char *buf, int length, Headers::Type type, PoolBase *pool=0)
 Constructor used by SipMessage. Unless you _really_ know what you're doing, don't touch this.
 ParserCategory (const ParserCategory &rhs, PoolBase *pool=0)
 Copy c'tor.
ParserCategoryoperator= (const ParserCategory &rhs)
 Assignment operator.
virtual ~ParserCategory ()
virtual ParserCategoryclone () const =0
virtual ParametercreateParam (ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool)
virtual ParserCategoryclone (void *location) const =0
virtual ParserCategoryclone (PoolBase *pool) const =0
bool exists (const ParamBase &paramType) const
 Checks for the existence of a natively supported parameter.
void remove (const ParamBase &paramType)
 Removes a natively supported parameter, if the parameter is present.
const Dataparam (const ExtensionParameter &param) const
 Const accessor for non-natively-supported parameter types.
Dataparam (const ExtensionParameter &param)
 Accessor for non-natively-supported parameter types.
void remove (const ExtensionParameter &param)
 Removes a non-natively-supported parameter, if the parameter is present.
bool exists (const ExtensionParameter &param) const
 Checks for the existence of a non-natively-supported parameter.
void removeParametersExcept (const ParameterTypeSet &set=EmptyParameterTypeSet)
 Removes all known parameters except those that are specified in set.
void clearUnknownParameters ()
void parseParameters (ParseBuffer &pb)
 Causes this ParserCategory to parse parameters out of pb.
EncodeStreamencodeParameters (EncodeStream &str) const
 Encodes parameters as they should appear on the wire.
Data commutativeParameterHash () const
 An order-sensitive hash over the set of parameters in this ParserCategory.
ParametergetParameterByEnum (ParameterTypes::Type type) const
 Typeless parameter get interface.
void removeParameterByEnum (ParameterTypes::Type type)
 Removes a parameter.
void setParameter (const Parameter *parameter)
 Typeless parameter put interface.
int numKnownParams () const
 Returns the number of known (natively supported) parameters.
int numUnknownParams () const
 Returns the number of unknown parameters.

Static Public Attributes

static const ParameterTypeSet EmptyParameterTypeSet

Protected Types

typedef std::vector< Parameter
*, StlPoolAllocator< Parameter
*, PoolBase > > 
ParameterList

Protected Member Functions

 ParserCategory (PoolBase *pool=0)
ParametergetParameterByData (const Data &data) const
void removeParameterByData (const Data &data)
PoolBasegetPool ()
void freeParameter (Parameter *p)
virtual const DataerrorContext () const

Protected Attributes

ParameterList mParameters
ParameterList mUnknownParameters
PoolBasemPool
Headers::Type mHeaderType

Private Member Functions

void clear ()
void copyParametersFrom (const ParserCategory &other)

Friends

class NameAddr
EncodeStreamoperator<< (EncodeStream &, const ParserCategory &)

Detailed Description

Base class for all SIP grammar elements that can have parameters.

The pattern for accessing the parameters in a ParserCategory is very similar to accessing headers in a SipMessage. Each parameter type has an access token class (a subclass of ParamBase), and a corresponding ParserCategory::param() function that takes an instance of that subclass as an argument, and returns the correct type for that parameter. Common examples of access-token include p_tag, p_q, p_lr, p_expires, p_branch, etc.

      NameAddr& contact = sip.header(h_Contacts).front();
      if(contact.exists(p_q))
      {
         QValueParameter& q = contact.param(p_q);
         // do stuff with q
      }

      NameAddr& to = sip.header(h_To);
      if(to.exists(p_tag))
      {
         DataParameter& toTag = to.param(p_tag);
         // do stuff with toTag
      }

      Via& topVia = sip.header(h_Vias).front();
      if(topVia.exists(p_branch))
      {
         BranchParameter& branch = topVia.param(p_branch);
         // do stuff with branch
      }

Note the calls to ParserCategory::exists() in the code above; calling ParserCategory::param() when the relevant parameter doesn't exist will either cause the parameter to be created, or an exception to be thrown (if you're working with a const reference).

In some cases, you will need to access parameter-types that are not natively supported by the stack (ie, don't have an access-token). ExtensionParameter will allow you to construct an access-token at runtime that will retrieve the parameter as a raw Data. Here's an example:

      // We need to access the foo parameter on the Request-Uri
      RequestLine& rLine = sip.header(h_RequestLine);
      static ExtensionParameter p_foo("foo");
      if(rLine.uri().exists(p_foo))
      {
         Data& foo = rLine.uri().param(p_foo);
      }
Todo:
Maybe a better name? IHaveParams? ElemWithParams?

Definition at line 84 of file ParserCategory.hxx.


Member Typedef Documentation

Definition at line 292 of file ParserCategory.hxx.

Definition at line 189 of file ParserCategory.hxx.


Member Enumeration Documentation

anonymous enum
Enumerator:
UnknownParserCategory 

Definition at line 87 of file ParserCategory.hxx.

anonymous enum
Enumerator:
NoCommaTokenizing 
CommasAllowedOutputMulti 
CommasAllowedOutputCommas 

Definition at line 95 of file ParserCategory.hxx.


Constructor & Destructor Documentation

ParserCategory::ParserCategory ( const HeaderFieldValue headerFieldValue,
Headers::Type  type,
PoolBase pool = 0 
)

Constructor used by SipMessage. Unless you _really_ know what you're doing, don't touch this.

Definition at line 30 of file ParserCategory.cxx.

ParserCategory::ParserCategory ( const char *  buf,
int  length,
Headers::Type  type,
PoolBase pool = 0 
)

Constructor used by SipMessage. Unless you _really_ know what you're doing, don't touch this.

Definition at line 41 of file ParserCategory.cxx.

ParserCategory::ParserCategory ( const ParserCategory rhs,
PoolBase pool = 0 
)

Copy c'tor.

Definition at line 61 of file ParserCategory.cxx.

References copyParametersFrom(), and resip::LazyParser::isParsed().

Here is the call graph for this function:

ParserCategory::~ParserCategory ( ) [virtual]

Definition at line 128 of file ParserCategory.cxx.

References clear().

Referenced by resip::ParserContainerBase::freeParser().

{
   clear();
}

Here is the call graph for this function:

ParserCategory::ParserCategory ( PoolBase pool = 0) [protected]

Member Function Documentation

void ParserCategory::clear ( void  ) [private]

Reimplemented from resip::LazyParser.

Definition at line 92 of file ParserCategory.cxx.

References freeParameter(), mParameters, and mUnknownParameters.

Referenced by operator=(), and ~ParserCategory().

{
   //DebugLog(<<"ParserCategory::clear");
   LazyParser::clear();

   while(!mParameters.empty())
   {
      freeParameter(mParameters.back());
      mParameters.pop_back();
   }

   while(!mUnknownParameters.empty())
   {
      freeParameter(mUnknownParameters.back());
      mUnknownParameters.pop_back();
   }
}

Here is the call graph for this function:

void ParserCategory::clearUnknownParameters ( )

Definition at line 201 of file ParserCategory.cxx.

References freeParameter(), and mUnknownParameters.

Referenced by resip::NameAddr::parse().

{
   for (ParameterList::iterator it = mUnknownParameters.begin();
        it != mUnknownParameters.end(); it++)
   {
      freeParameter(*it);
   }   
   mUnknownParameters.clear();
}

Here is the call graph for this function:

virtual ParserCategory* resip::ParserCategory::clone ( ) const [pure virtual]
virtual ParserCategory* resip::ParserCategory::clone ( void *  location) const [pure virtual]
virtual ParserCategory* resip::ParserCategory::clone ( PoolBase pool) const [pure virtual]
Data ParserCategory::commutativeParameterHash ( ) const

An order-sensitive hash over the set of parameters in this ParserCategory.

Returns:
The hash value as a Data.

Definition at line 423 of file ParserCategory.cxx.

References resip::Data::clear(), resip::UnknownParameter::getName(), mParameters, mUnknownParameters, and resip::UnknownParameter::value().

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

{
   Data buffer;
   Data working;

   for (ParameterList::const_iterator i = mParameters.begin(); i != mParameters.end(); ++i)
   {
      if ((*i)->getType() != ParameterTypes::lr)
      {
         buffer.clear();
         {
            DataStream strm(buffer);
            (*i)->encode(strm);
         }
         working ^= buffer;
      }
   }

   buffer.clear();
   for (ParameterList::const_iterator i = mUnknownParameters.begin(); i != mUnknownParameters.end(); ++i)
   {
      UnknownParameter* p = static_cast<UnknownParameter*>(*i);
      buffer = p->getName();
      buffer += p->value();
      working ^= buffer;
   }
   
   return working;
}

Here is the call graph for this function:

void ParserCategory::copyParametersFrom ( const ParserCategory other) [private]

Definition at line 111 of file ParserCategory.cxx.

References mParameters, and mUnknownParameters.

Referenced by operator=(), and ParserCategory().

{
   mParameters.reserve(other.mParameters.size());
   mUnknownParameters.reserve(other.mUnknownParameters.size());
   
   for (ParameterList::const_iterator it = other.mParameters.begin();
        it != other.mParameters.end(); it++)
   {
      mParameters.push_back((*it)->clone());
   }
   for (ParameterList::const_iterator it = other.mUnknownParameters.begin();
        it != other.mUnknownParameters.end(); it++)
   {
      mUnknownParameters.push_back((*it)->clone());
   }
}
Parameter * ParserCategory::createParam ( ParameterTypes::Type  type,
ParseBuffer pb,
const std::bitset< 256 > &  terminators,
PoolBase pool 
) [virtual]
EncodeStream & ParserCategory::encodeParameters ( EncodeStream str) const

Encodes parameters as they should appear on the wire.

Parameters:
strThe ostream to encode to.
Returns:
str

Definition at line 262 of file ParserCategory.cxx.

References resip::Data::empty(), getParameterByData(), mParameters, mUnknownParameters, resip::Symbols::SEMI_COLON, resip::Symbols::SPACE, type, up_Msgr, and resip::DataParameter::value().

Referenced by resip::IntegerCategory::encodeParsed(), resip::UInt32Category::encodeParsed(), resip::ExpiresCategory::encodeParsed(), resip::GenericUri::encodeParsed(), resip::CallID::encodeParsed(), resip::Via::encodeParsed(), resip::Token::encodeParsed(), resip::Mime::encodeParsed(), resip::NameAddr::encodeParsed(), and resip::Uri::encodeParsed().

{
    
   for (ParameterList::const_iterator it = mParameters.begin();
        it != mParameters.end(); it++)
   {
#if 0
      // !cj! - may be wrong just hacking 
      // The goal of all this is not to add a tag if the tag is empty 
      ParameterTypes::Type type = (*it)->getType();
      
      if ( type ==  ParameterTypes::tag )
      {
         Parameter* p = (*it);
         DataParameter* d = dynamic_cast<DataParameter*>(p);
         
         Data& data = d->value();
         
         if ( !data.empty() )
         {
            str << Symbols::SEMI_COLON;
            // !ah! this is a TOTAL hack to work around an MSN bug that
            // !ah! requires a SPACE after the SEMI following the MIME type.
            if (it == mParameters.begin() && getParameterByData(up_Msgr))
            {
               str << Symbols::SPACE;
            }

            (*it)->encode(str);
         }
      }
      else
      {
         str << Symbols::SEMI_COLON;
         // !ah! this is a TOTAL hack to work around an MSN bug that
         // !ah! requires a SPACE after the SEMI following the MIME type.
         if (it == mParameters.begin() && getParameterByData(up_Msgr))
         {
            str << Symbols::SPACE;
         }

         (*it)->encode(str);
      }
      
#else
      str << Symbols::SEMI_COLON;
      // !ah! this is a TOTAL hack to work around an MSN bug that
      // !ah! requires a SPACE after the SEMI following the MIME type.
      if (it == mParameters.begin() && getParameterByData(up_Msgr))
      {
         str << Symbols::SPACE;
      }
      
      (*it)->encode(str);
#endif
   }
   for (ParameterList::const_iterator it = mUnknownParameters.begin();
        it != mUnknownParameters.end(); it++)
   {
      str << Symbols::SEMI_COLON;
      (*it)->encode(str);
   }
   return str;
}

Here is the call graph for this function:

const Data & ParserCategory::errorContext ( ) const [protected, virtual]

Implements resip::LazyParser.

Definition at line 454 of file ParserCategory.cxx.

References resip::Headers::getHeaderName(), and mHeaderType.

Here is the call graph for this function:

bool resip::ParserCategory::exists ( const ParamBase paramType) const [inline]

Checks for the existence of a natively supported parameter.

Parameters:
paramTypeThe accessor token for the parameter.
Returns:
true iff the parameter is present.

Definition at line 145 of file ParserCategory.hxx.

References resip::LazyParser::checkParsed(), getParameterByEnum(), and resip::ParamBase::getTypeNum().

      {
          checkParsed();
          return (getParameterByEnum(paramType.getTypeNum()) != NULL);
      }

Here is the call graph for this function:

bool ParserCategory::exists ( const ExtensionParameter param) const

Checks for the existence of a non-natively-supported parameter.

Parameters:
paramThe runtime constructed accessor token.
Returns:
true iff the parameter is present.

Definition at line 175 of file ParserCategory.cxx.

References resip::LazyParser::checkParsed(), resip::ExtensionParameter::getName(), and getParameterByData().

{
   checkParsed();
   return getParameterByData(param.getName()) != NULL;
}

Here is the call graph for this function:

void resip::ParserCategory::freeParameter ( Parameter p) [inline, protected]

Definition at line 276 of file ParserCategory.hxx.

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

Referenced by clear(), clearUnknownParameters(), removeParameterByData(), removeParameterByEnum(), removeParametersExcept(), and setParameter().

      {
         if(p)
         {
            p->~Parameter();
            if(mPool)
            {
               mPool->deallocate(p);
               return;
            }
            ::operator delete(p);
         }
      }

Here is the call graph for this function:

Parameter * ParserCategory::getParameterByData ( const Data data) const [protected]

Definition at line 390 of file ParserCategory.cxx.

References resip::isEqualNoCase(), and mUnknownParameters.

Referenced by encodeParameters(), exists(), and param().

{
   for (ParameterList::const_iterator it = mUnknownParameters.begin();
        it != mUnknownParameters.end(); it++)
   {
      if (isEqualNoCase((*it)->getName(), data))
      {
         return *it;
      }
   }
   return 0;
}

Here is the call graph for this function:

Parameter * ParserCategory::getParameterByEnum ( ParameterTypes::Type  type) const

Typeless parameter get interface.

Definition at line 335 of file ParserCategory.cxx.

References mParameters, and type.

Referenced by resip::Auth::exists(), resip::GenericUri::exists(), resip::UInt32Category::exists(), resip::ExpiresCategory::exists(), resip::CallID::exists(), resip::Via::exists(), resip::Token::exists(), resip::Mime::exists(), resip::NameAddr::exists(), exists(), resip::Uri::exists(), main(), and resip::Uri::operator==().

{
   for (ParameterList::const_iterator it = mParameters.begin();
        it != mParameters.end(); it++)
   {
      if ((*it)->getType() == type)
      {
         return *it;
      }
   }
   return 0;
}
PoolBase* resip::ParserCategory::getPool ( ) [inline, protected]

Definition at line 271 of file ParserCategory.hxx.

References mPool.

Referenced by resip::Auth::parseAuthParameters(), and parseParameters().

      {
         return mPool;
      }
int resip::ParserCategory::numKnownParams ( ) const [inline]

Returns the number of known (natively supported) parameters.

Definition at line 259 of file ParserCategory.hxx.

References mParameters.

{return (int)mParameters.size();};
int resip::ParserCategory::numUnknownParams ( ) const [inline]

Returns the number of unknown parameters.

Definition at line 264 of file ParserCategory.hxx.

References mUnknownParameters.

{return (int)mUnknownParameters.size();};
ParserCategory & ParserCategory::operator= ( const ParserCategory rhs)

Assignment operator.

Definition at line 76 of file ParserCategory.cxx.

References clear(), copyParametersFrom(), resip::LazyParser::isParsed(), and mHeaderType.

{
   if (this != &rhs)
   {
      clear();
      mHeaderType = rhs.mHeaderType;
      LazyParser::operator=(rhs);
      if (rhs.isParsed())
      {
         copyParametersFrom(rhs);
      }
   }
   return *this;
}

Here is the call graph for this function:

const Data & ParserCategory::param ( const ExtensionParameter param) const

Const accessor for non-natively-supported parameter types.

Exceptions:
ParserCategory::Exceptionif this parameter doesn't exist.
Parameters:
paramThe runtime constructed parameter accessor.
Returns:
The parameter, as a raw Data.

Definition at line 134 of file ParserCategory.cxx.

References resip::LazyParser::checkParsed(), resip::ExtensionParameter::getName(), getParameterByData(), InfoLog, and value.

Referenced by resip::Helper::algorithmAndQopSupported(), resip::DeprecatedDialog::createDialogAsUAC(), resip::DeprecatedDialog::dialogId(), resip::MultipartMixedContents::encodeParsed(), findRlmi(), resip::Uri::fromTel(), resip::DnsResult::lookupInternal(), main(), resip::Helper::makeChallenge(), resip::Helper::makeChallengeResponseAuth(), resip::Helper::makeChallengeResponseAuthWithA1(), resip::Helper::makeMessage(), resip::Helper::makePublish(), resip::Helper::makeRegister(), resip::Helper::makeRequest(), resip::DeprecatedDialog::makeRequestInternal(), resip::DeprecatedDialog::makeResponse(), resip::Helper::makeSubscribe(), resip::Helper::massageRoute(), resip::SipMessage::mergeUri(), resip::Uri::operator==(), resip::MultipartMixedContents::parse(), performTest(), resip::TransactionState::process(), resip::UdpTransport::processRxParse(), resip::Helper::qopOption(), Loadgen::Transceiver::send(), resip::TuIM::sendNotify(), resip::MultipartMixedContents::setBoundary(), resip::TuIM::setOutbound(), simpleTupleForUri(), Client::thread(), Server::thread(), Loadgen::Transceiver::Transceiver(), resip::TransportSelector::transmit(), resip::DeprecatedDialog::updateRequest(), and resip::Via::Via().

{
   checkParsed();
   Parameter* p = getParameterByData(param.getName());
   if (!p)
   {
      InfoLog(<< "Referenced an unknown parameter " << param.getName());
      throw Exception("Missing unknown parameter", __FILE__, __LINE__);
   }
   return static_cast<UnknownParameter*>(p)->value();
}

Here is the call graph for this function:

Data & ParserCategory::param ( const ExtensionParameter param)

Accessor for non-natively-supported parameter types.

Will create the parameter if it does not exist.

Parameters:
paramThe runtime constructed parameter accessor.
Returns:
The parameter, as a raw Data.

Definition at line 147 of file ParserCategory.cxx.

References resip::LazyParser::checkParsed(), resip::ExtensionParameter::getName(), getParameterByData(), mUnknownParameters, and value.

{
   checkParsed();
   Parameter* p = getParameterByData(param.getName());
   if (!p)
   {
      p = new UnknownParameter(param.getName());
      mUnknownParameters.push_back(p);
   } 
   return static_cast<UnknownParameter*>(p)->value();
}

Here is the call graph for this function:

void ParserCategory::parseParameters ( ParseBuffer pb)

Causes this ParserCategory to parse parameters out of pb.

Parameters:
pbThe ParseBuffer to parse params from.

dlb! @ here?

Definition at line 212 of file ParserCategory.cxx.

References createParam(), resip::ParseBuffer::eof(), getPool(), resip::ParameterTypes::getType(), mParameters, mUnknownParameters, resip::ParseBuffer::position(), resip::ParseBuffer::reset(), resip::Symbols::SEMI_COLON, resip::ParseBuffer::skipChar(), resip::ParseBuffer::skipToOneOf(), resip::ParseBuffer::skipWhitespace(), resip::Data::toBitset(), type, and resip::ParameterTypes::UNKNOWN.

Referenced by resip::IntegerCategory::parse(), resip::GenericUri::parse(), resip::UInt32Category::parse(), resip::ExpiresCategory::parse(), resip::CallID::parse(), resip::Via::parse(), resip::Token::parse(), resip::Mime::parse(), resip::NameAddr::parse(), and resip::Uri::parse().

{
   while (!pb.eof() )
   {
      const char* start = pb.position();
      pb.skipWhitespace();

      if (  (!pb.eof() && *pb.position() == Symbols::SEMI_COLON[0]) )
      {
         // extract the key
         pb.skipChar();
         const char* keyStart = pb.skipWhitespace();
         static std::bitset<256> terminators1=Data::toBitset(" \t\r\n;=?>"); 
         const char* keyEnd = pb.skipToOneOf(terminators1);  

         if((int)(keyEnd-keyStart) != 0)
         {
            ParameterTypes::Type type = ParameterTypes::getType(keyStart, (unsigned int)(keyEnd - keyStart));
            static std::bitset<256> terminators2 = Data::toBitset(" \t\r\n;?>");
            Parameter* p;
            if (type == ParameterTypes::UNKNOWN || 
               !(p=createParam(type, pb, terminators2,getPool())))
            {
               mUnknownParameters.push_back(new (getPool()) UnknownParameter(keyStart, 
                                                                 int((keyEnd - keyStart)), pb, terminators2));
            }
            else
            {
               // invoke the particular factory
               mParameters.push_back(p);
            }
         }
      }
      else
      {
         pb.reset(start);
         return;
      }
   }
}      

Here is the call graph for this function:

void ParserCategory::remove ( const ParamBase paramType)

Removes a natively supported parameter, if the parameter is present.

Parameters:
paramTypeThe accessor token for the parameter.

Definition at line 161 of file ParserCategory.cxx.

References resip::LazyParser::checkParsed(), resip::ParamBase::getTypeNum(), and removeParameterByEnum().

Here is the call graph for this function:

void ParserCategory::remove ( const ExtensionParameter param)

Removes a non-natively-supported parameter, if the parameter is present.

Parameters:
paramThe accessor token for the parameter.

Definition at line 168 of file ParserCategory.cxx.

References resip::LazyParser::checkParsed(), resip::ExtensionParameter::getName(), and removeParameterByData().

Here is the call graph for this function:

void ParserCategory::removeParameterByData ( const Data data) [protected]

Definition at line 404 of file ParserCategory.cxx.

References freeParameter(), and mUnknownParameters.

Referenced by remove().

{
   // remove all instances
   for (ParameterList::iterator it = mUnknownParameters.begin();
        it != mUnknownParameters.end();)
   {
      if ((*it)->getName() == data)
      {
         freeParameter(*it);
         it = mUnknownParameters.erase(it);
      }
      else
      {
         ++it;
      }
   }
}

Here is the call graph for this function:

void ParserCategory::removeParameterByEnum ( ParameterTypes::Type  type)

Removes a parameter.

Parameters:
typeThe parameter type.

Definition at line 371 of file ParserCategory.cxx.

References freeParameter(), mParameters, and type.

Referenced by resip::Auth::remove(), resip::GenericUri::remove(), resip::UInt32Category::remove(), resip::ExpiresCategory::remove(), resip::CallID::remove(), resip::Via::remove(), resip::Token::remove(), resip::Mime::remove(), resip::NameAddr::remove(), remove(), and resip::Uri::remove().

{
   // remove all instances
   for (ParameterList::iterator it = mParameters.begin();
        it != mParameters.end();)
   {
      if ((*it)->getType() == type)
      {
         freeParameter(*it);
         it = mParameters.erase(it);
      }
      else
      {
         ++it;
      }
   }
 }

Here is the call graph for this function:

void ParserCategory::removeParametersExcept ( const ParameterTypeSet set = EmptyParameterTypeSet)

Removes all known parameters except those that are specified in set.

Parameters:
setThe set of parameters to retain, as an enum.
Note:
This does not remove unknown parameters.

Definition at line 182 of file ParserCategory.cxx.

References resip::LazyParser::checkParsed(), freeParameter(), and mParameters.

{
   checkParsed();
   for (ParameterList::iterator it = mParameters.begin();
        it != mParameters.end();)
   {
      if (set.find((*it)->getType()) == set.end())
      {
         freeParameter(*it);
         it = mParameters.erase(it);
      }
      else
      {
         ++it;
      }
   }
}

Here is the call graph for this function:

void ParserCategory::setParameter ( const Parameter parameter)

Typeless parameter put interface.

Definition at line 349 of file ParserCategory.cxx.

References resip::Parameter::clone(), freeParameter(), resip::Parameter::getType(), and mParameters.

Referenced by main().

{
   assert(parameter);

   for (ParameterList::iterator it = mParameters.begin();
        it != mParameters.end(); it++)
   {
      if ((*it)->getType() == parameter->getType())
      {
         freeParameter(*it);
         mParameters.erase(it);
         mParameters.push_back(parameter->clone());
         return;
      }
   }

   // !dlb! kinda hacky -- what is the correct semantics here?
   // should be quietly add, quietly do nothing, throw?
   mParameters.push_back(parameter->clone());
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class NameAddr [friend]

Definition at line 301 of file ParserCategory.hxx.

EncodeStream& operator<< ( EncodeStream ,
const ParserCategory  
) [friend]

Member Data Documentation

Definition at line 191 of file ParserCategory.hxx.

Definition at line 296 of file ParserCategory.hxx.

Referenced by resip::Auth::createParam(), errorContext(), and operator=().

Definition at line 295 of file ParserCategory.hxx.

Referenced by freeParameter(), and getPool().


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