reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
TokenOrQuotedStringCategory.hxx
Go to the documentation of this file.
1#if !defined(RESIP_TOKEN_OR_QUOTED_STRING_CATEGORY_HXX)
2#define RESIP_TOKEN_OR_QUOTED_STRING_CATEGORY_HXX
3
4#include <iosfwd>
5#include "rutil/Data.hxx"
8
9namespace resip
10{
11
19{
20 public:
22
24 explicit TokenOrQuotedStringCategory(const Data& value, bool quoted);
26 Headers::Type type,
27 PoolBase* pool = 0);
29 PoolBase* pool = 0);
31
32 virtual ParserCategory* clone() const;
33 virtual ParserCategory* clone(void* location) const;
34 virtual ParserCategory* clone(PoolBase* pool) const;
35
36 bool isEqual(const TokenOrQuotedStringCategory& rhs) const;
37 bool operator==(const TokenOrQuotedStringCategory& rhs) const;
38 bool operator!=(const TokenOrQuotedStringCategory& rhs) const;
39 bool operator<(const TokenOrQuotedStringCategory& rhs) const;
40
41 virtual void parse(ParseBuffer& pb);
42 virtual EncodeStream& encodeParsed(EncodeStream& str) const;
43
44 // Gets the value (ie; no parameters) of this Token as a Data&.
45 const Data& value() const;
46 Data& value();
47
48 // mValue will be enclosed in quotes e.g. "foo"
49 bool isQuoted() const { return mQuoted; }
50 void setQuoted(bool b) { mQuoted = b; };
51
52 Data quotedValue() const;
53
54 // Inform the compiler that overloads of these may be found in ParserCategory, too.
58
59 virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool);
60 bool exists(const Param<TokenOrQuotedStringCategory>& paramType) const;
61 void remove(const Param<TokenOrQuotedStringCategory>& paramType);
62
63#define defineParam(_enum, _name, _type, _RFC_ref_ignored) \
64 const _enum##_Param::DType& param(const _enum##_Param& paramType) const; \
65 _enum##_Param::DType& param(const _enum##_Param& paramType); \
66 friend class _enum##_Param
67
68 defineParam(purpose, "purpose", DataParameter, "draft-ietf-cuss-sip-uui-17"); // User-to-User
69 defineParam(content, "content", DataParameter, "draft-ietf-cuss-sip-uui-17"); // User-to-User
70 defineParam(encoding, "encoding", DataParameter, "draft-ietf-cuss-sip-uui-17"); // User-to-User
71
72#undef defineParam
73
74 private:
75 Data mValue;
76 bool mQuoted;
77
79};
80
82
83}
84
85#endif
86
87/* ====================================================================
88 * The Vovida Software License, Version 1.0
89 *
90 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
91 *
92 * Redistribution and use in source and binary forms, with or without
93 * modification, are permitted provided that the following conditions
94 * are met:
95 *
96 * 1. Redistributions of source code must retain the above copyright
97 * notice, this list of conditions and the following disclaimer.
98 *
99 * 2. Redistributions in binary form must reproduce the above copyright
100 * notice, this list of conditions and the following disclaimer in
101 * the documentation and/or other materials provided with the
102 * distribution.
103 *
104 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
105 * and "Vovida Open Communication Application Library (VOCAL)" must
106 * not be used to endorse or promote products derived from this
107 * software without prior written permission. For written
108 * permission, please contact vocal@vovida.org.
109 *
110 * 4. Products derived from this software may not be called "VOCAL", nor
111 * may "VOCAL" appear in their name, without prior written
112 * permission of Vovida Networks, Inc.
113 *
114 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
115 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
116 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
117 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
118 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
119 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
120 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
121 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
122 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
123 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
124 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
125 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
126 * DAMAGE.
127 *
128 * ====================================================================
129 *
130 * This software consists of voluntary contributions made by Vovida
131 * Networks, Inc. and many individuals on behalf of Vovida Networks,
132 * Inc. For more information on Vovida Networks, Inc., please see
133 * <http://www.vovida.org/>.
134 *
135 */
Generically represents miscellaneous parameter data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Parameter *(* Factory)(ParameterTypes::Type, ParseBuffer &, const std::bitset< 256 > &terminators, PoolBase *pool)
Provides string-parsing functionality with protection from buffer overflow.
Base class for all SIP grammar elements that can have parameters.
void remove(const ParamBase &paramType)
Removes a natively supported parameter, if the parameter is present.
bool exists(const ParamBase &paramType) const
Checks for the existence of a natively supported parameter.
const Data & param(const ExtensionParameter &param) const
Const accessor for non-natively-supported parameter types.
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
Generically represents a token whose value can be wrapped and encoded using double quotes.
bool isEqual(const TokenOrQuotedStringCategory &rhs) const
virtual EncodeStream & encodeParsed(EncodeStream &str) const
bool operator==(const TokenOrQuotedStringCategory &rhs) const
bool operator!=(const TokenOrQuotedStringCategory &rhs) const
static constexpr CommaHandlingMode commaHandling
defineParam(content, "content", DataParameter, "draft-ietf-cuss-sip-uui-17")
defineParam(encoding, "encoding", DataParameter, "draft-ietf-cuss-sip-uui-17")
defineParam(purpose, "purpose", DataParameter, "draft-ietf-cuss-sip-uui-17")
virtual Parameter * createParam(ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool)
TokenOrQuotedStringCategory & operator=(const TokenOrQuotedStringCategory &rhs)
bool operator<(const TokenOrQuotedStringCategory &rhs) const
void remove(const Param< TokenOrQuotedStringCategory > &paramType)
bool exists(const Param< TokenOrQuotedStringCategory > &paramType) const
dcm! – add UnusedChecking(_enum) below;
ParserContainer< TokenOrQuotedStringCategory > TokenOrQuotedStringCategories
#define EncodeStream