|
reSIProcate/stack
9694
|
Base class for all SIP grammar elements that can have parameters. More...
#include <ParserCategory.hxx>


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. | |
| ParserCategory & | operator= (const ParserCategory &rhs) |
| Assignment operator. | |
| virtual | ~ParserCategory () |
| virtual ParserCategory * | clone () const =0 |
| virtual Parameter * | createParam (ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool) |
| virtual ParserCategory * | clone (void *location) const =0 |
| virtual ParserCategory * | clone (PoolBase *pool) const =0 |
| bool | exists (const ParamBase ¶mType) const |
| Checks for the existence of a natively supported parameter. | |
| void | remove (const ParamBase ¶mType) |
| Removes a natively supported parameter, if the parameter is present. | |
| const Data & | param (const ExtensionParameter ¶m) const |
| Const accessor for non-natively-supported parameter types. | |
| Data & | param (const ExtensionParameter ¶m) |
| Accessor for non-natively-supported parameter types. | |
| void | remove (const ExtensionParameter ¶m) |
| Removes a non-natively-supported parameter, if the parameter is present. | |
| bool | exists (const ExtensionParameter ¶m) 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. | |
| EncodeStream & | encodeParameters (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. | |
| Parameter * | getParameterByEnum (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) | |
| Parameter * | getParameterByData (const Data &data) const |
| void | removeParameterByData (const Data &data) |
| PoolBase * | getPool () |
| void | freeParameter (Parameter *p) |
| virtual const Data & | errorContext () const |
Protected Attributes | |
| ParameterList | mParameters |
| ParameterList | mUnknownParameters |
| PoolBase * | mPool |
| Headers::Type | mHeaderType |
Private Member Functions | |
| void | clear () |
| void | copyParametersFrom (const ParserCategory &other) |
Friends | |
| class | NameAddr |
| EncodeStream & | operator<< (EncodeStream &, const ParserCategory &) |
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); }
Definition at line 84 of file ParserCategory.hxx.
typedef std::vector<Parameter*, StlPoolAllocator<Parameter*, PoolBase> > resip::ParserCategory::ParameterList [protected] |
Definition at line 292 of file ParserCategory.hxx.
| typedef std::set<ParameterTypes::Type> resip::ParserCategory::ParameterTypeSet |
Definition at line 189 of file ParserCategory.hxx.
| anonymous enum |
Definition at line 87 of file ParserCategory.hxx.
{UnknownParserCategory = -1};
| anonymous enum |
Definition at line 95 of file ParserCategory.hxx.
{NoCommaTokenizing = 0, CommasAllowedOutputMulti = 1, CommasAllowedOutputCommas = 3};
| 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.
: LazyParser(headerFieldValue), mParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mUnknownParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mPool(pool), mHeaderType(headerType) { }
| 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.
: LazyParser(buf, length), mParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mUnknownParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mPool(pool), mHeaderType(type) {}
| 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().
: LazyParser(rhs), mParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mUnknownParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mPool(pool), mHeaderType(rhs.mHeaderType) { if (isParsed()) { copyParametersFrom(rhs); } }

| ParserCategory::~ParserCategory | ( | ) | [virtual] |
Definition at line 128 of file ParserCategory.cxx.
References clear().
Referenced by resip::ParserContainerBase::freeParser().
{
clear();
}

| ParserCategory::ParserCategory | ( | PoolBase * | pool = 0 | ) | [protected] |
Definition at line 52 of file ParserCategory.cxx.
: LazyParser(), mParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mUnknownParameters(StlPoolAllocator<Parameter*, PoolBase>(pool)), mPool(pool), mHeaderType(Headers::NONE) { }
| 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();
}
}

| 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();
}

| virtual ParserCategory* resip::ParserCategory::clone | ( | ) | const [pure virtual] |
Implemented in resip::Uri, resip::DateCategory, resip::NameAddr, resip::Mime, resip::RAckCategory, resip::Token, resip::Via, resip::CSeqCategory, resip::CallID, resip::PrivacyCategory, resip::ExpiresCategory, resip::StringCategory, resip::UInt32Category, resip::WarningCategory, resip::GenericUri, resip::IntegerCategory, and resip::Auth.
Referenced by resip::ParserContainerBase::makeParser().
| virtual ParserCategory* resip::ParserCategory::clone | ( | void * | location | ) | const [pure virtual] |
Implemented in resip::Uri, resip::DateCategory, resip::NameAddr, resip::Mime, resip::RAckCategory, resip::Token, resip::Via, resip::CSeqCategory, resip::CallID, resip::PrivacyCategory, resip::ExpiresCategory, resip::StringCategory, resip::UInt32Category, resip::WarningCategory, resip::GenericUri, resip::IntegerCategory, and resip::Auth.
| virtual ParserCategory* resip::ParserCategory::clone | ( | PoolBase * | pool | ) | const [pure virtual] |
Implemented in resip::Uri, resip::DateCategory, resip::NameAddr, resip::Mime, resip::RAckCategory, resip::Token, resip::Via, resip::CSeqCategory, resip::CallID, resip::PrivacyCategory, resip::ExpiresCategory, resip::StringCategory, resip::UInt32Category, resip::WarningCategory, resip::GenericUri, resip::IntegerCategory, and resip::Auth.
| Data ParserCategory::commutativeParameterHash | ( | ) | const |
An order-sensitive hash over the set of parameters in this ParserCategory.
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;
}

| 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] |
Reimplemented in resip::Uri, resip::NameAddr, resip::Mime, resip::Token, resip::Via, resip::CallID, resip::ExpiresCategory, resip::UInt32Category, resip::Auth, and resip::GenericUri.
Definition at line 254 of file ParserCategory.cxx.
Referenced by parseParameters().
{
return 0;
}
| EncodeStream & ParserCategory::encodeParameters | ( | EncodeStream & | str | ) | const |
Encodes parameters as they should appear on the wire.
| str | The ostream to encode to. |
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;
}

| const Data & ParserCategory::errorContext | ( | ) | const [protected, virtual] |
Implements resip::LazyParser.
Definition at line 454 of file ParserCategory.cxx.
References resip::Headers::getHeaderName(), and mHeaderType.
{
return Headers::getHeaderName(mHeaderType);
}

| bool resip::ParserCategory::exists | ( | const ParamBase & | paramType | ) | const [inline] |
Checks for the existence of a natively supported parameter.
| paramType | The accessor token for the parameter. |
Definition at line 145 of file ParserCategory.hxx.
References resip::LazyParser::checkParsed(), getParameterByEnum(), and resip::ParamBase::getTypeNum().
{
checkParsed();
return (getParameterByEnum(paramType.getTypeNum()) != NULL);
}

| bool ParserCategory::exists | ( | const ExtensionParameter & | param | ) | const |
Checks for the existence of a non-natively-supported parameter.
| param | The runtime constructed accessor token. |
Definition at line 175 of file ParserCategory.cxx.
References resip::LazyParser::checkParsed(), resip::ExtensionParameter::getName(), and getParameterByData().
{
checkParsed();
return getParameterByData(param.getName()) != NULL;
}

| 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().

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;
}

| 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;
}

| const Data & ParserCategory::param | ( | const ExtensionParameter & | param | ) | const |
Const accessor for non-natively-supported parameter types.
| ParserCategory::Exception | if this parameter doesn't exist. |
| param | The runtime constructed parameter accessor. |
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();
}

| Data & ParserCategory::param | ( | const ExtensionParameter & | param | ) |
Accessor for non-natively-supported parameter types.
Will create the parameter if it does not exist.
| param | The runtime constructed parameter accessor. |
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();
}

| void ParserCategory::parseParameters | ( | ParseBuffer & | pb | ) |
Causes this ParserCategory to parse parameters out of pb.
| pb | The 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;
}
}
}

| void ParserCategory::remove | ( | const ParamBase & | paramType | ) |
Removes a natively supported parameter, if the parameter is present.
| paramType | The accessor token for the parameter. |
Definition at line 161 of file ParserCategory.cxx.
References resip::LazyParser::checkParsed(), resip::ParamBase::getTypeNum(), and removeParameterByEnum().
{
checkParsed();
removeParameterByEnum(paramType.getTypeNum());
}

| void ParserCategory::remove | ( | const ExtensionParameter & | param | ) |
Removes a non-natively-supported parameter, if the parameter is present.
| param | The accessor token for the parameter. |
Definition at line 168 of file ParserCategory.cxx.
References resip::LazyParser::checkParsed(), resip::ExtensionParameter::getName(), and removeParameterByData().
{
checkParsed();
removeParameterByData(param.getName());
}

| 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;
}
}
}

| void ParserCategory::removeParameterByEnum | ( | ParameterTypes::Type | type | ) |
Removes a parameter.
| type | The 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;
}
}
}

| void ParserCategory::removeParametersExcept | ( | const ParameterTypeSet & | set = EmptyParameterTypeSet | ) |
Removes all known parameters except those that are specified in set.
| set | The set of parameters to retain, as an enum. |
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;
}
}
}

| 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());
}

friend class NameAddr [friend] |
Definition at line 301 of file ParserCategory.hxx.
| EncodeStream& operator<< | ( | EncodeStream & | , |
| const ParserCategory & | |||
| ) | [friend] |
Definition at line 191 of file ParserCategory.hxx.
Headers::Type resip::ParserCategory::mHeaderType [protected] |
Definition at line 296 of file ParserCategory.hxx.
Referenced by resip::Auth::createParam(), errorContext(), and operator=().
ParameterList resip::ParserCategory::mParameters [protected] |
Definition at line 293 of file ParserCategory.hxx.
Referenced by clear(), commutativeParameterHash(), copyParametersFrom(), resip::Auth::encodeAuthParameters(), encodeParameters(), getParameterByEnum(), numKnownParams(), resip::Uri::operator==(), resip::Auth::parseAuthParameters(), parseParameters(), removeParameterByEnum(), removeParametersExcept(), and setParameter().
PoolBase* resip::ParserCategory::mPool [protected] |
Definition at line 295 of file ParserCategory.hxx.
Referenced by freeParameter(), and getPool().
Definition at line 294 of file ParserCategory.hxx.
Referenced by clear(), clearUnknownParameters(), commutativeParameterHash(), copyParametersFrom(), resip::Auth::encodeAuthParameters(), encodeParameters(), getParameterByData(), numUnknownParams(), resip::Uri::operator==(), param(), resip::NameAddr::parse(), resip::Auth::parseAuthParameters(), parseParameters(), and removeParameterByData().
1.7.5.1