reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
PrivacyCategory.cxx
Go to the documentation of this file.
2
4
5namespace resip
6{
11
12static const Data parseContext("PrivacyCategory constructor");
15 mValue()
16{
17 HeaderFieldValue hfv(d.data(), d.size());
19 tmp.checkParsed();
20 *this = tmp;
21}
22
24 Headers::Type type,
25 PoolBase* pool)
26 : ParserCategory(hfv, type, pool),
27 mValue()
28{}
29
31 PoolBase* pool)
32 : ParserCategory(rhs, pool),
33 mValue(rhs.mValue)
34{}
35
38{
39 if (this != &rhs)
40 {
42 mValue = rhs.mValue;
43 }
44 return *this;
45}
46
47const std::vector<Data>&
49{
51 return mValue;
52}
53
54std::vector<Data>&
56{
58 return mValue;
59}
60
61void
63{
64 while(!pb.eof())
65 {
66 pb.skipWhitespace();
67 if(!pb.eof())
68 {
69 const char* start=pb.position();
71 if(pb.position()==start)
72 {
73 throw ParseException("Empty privacy token!",
74 "PrivacyCategory::parse()",
75 __FILE__, __LINE__);
76 }
77 mValue.push_back(pb.data(start));
78 pb.skipWhitespace();
79 }
80 if(!pb.eof())
81 {
82 pb.skipChar(';');
83 }
84 }
85}
86
89{
90 return new PrivacyCategory(*this);
91}
92
94PrivacyCategory::clone(void* location) const
95{
96 return new (location) PrivacyCategory(*this);
97}
98
101{
102 return new (pool) PrivacyCategory(*this, pool);
103}
104
107{
108 bool first=true;
109 for(std::vector<Data>::const_iterator i=mValue.begin(); i!=mValue.end(); ++i)
110 {
111 if(first)
112 {
113 first=false;
114 }
115 else
116 {
117 str << ';';
118 }
119 str << *i;
120 }
121 return str;
122}
123
124} // of namespace resip
125
126/* ====================================================================
127 * The Vovida Software License, Version 1.0
128 *
129 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
130 *
131 * Redistribution and use in source and binary forms, with or without
132 * modification, are permitted provided that the following conditions
133 * are met:
134 *
135 * 1. Redistributions of source code must retain the above copyright
136 * notice, this list of conditions and the following disclaimer.
137 *
138 * 2. Redistributions in binary form must reproduce the above copyright
139 * notice, this list of conditions and the following disclaimer in
140 * the documentation and/or other materials provided with the
141 * distribution.
142 *
143 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
144 * and "Vovida Open Communication Application Library (VOCAL)" must
145 * not be used to endorse or promote products derived from this
146 * software without prior written permission. For written
147 * permission, please contact vocal@vovida.org.
148 *
149 * 4. Products derived from this software may not be called "VOCAL", nor
150 * may "VOCAL" appear in their name, without prior written
151 * permission of Vovida Networks, Inc.
152 *
153 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
154 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
155 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
156 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
157 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
158 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
159 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
160 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
161 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
162 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
163 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
164 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
165 * DAMAGE.
166 *
167 * ====================================================================
168 *
169 * This software consists of voluntary contributions made by Vovida
170 * Networks, Inc. and many individuals on behalf of Vovida Networks,
171 * Inc. For more information on Vovida Networks, Inc., please see
172 * <http://www.vovida.org/>.
173 *
174 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
size_type size() const noexcept
Returns the number of bytes in this Data.
Definition Data.hxx:599
const char * data() const noexcept
Returns a pointer to the contents of this Data.
Definition Data.hxx:608
void checkParsed() const
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipWhitespace()
CurrentPosition position() const
CurrentPosition skipToOneOf(const char *cs)
CurrentPosition skipChar()
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
static const char * Whitespace
BaseException used to indicate parse failures.
Base class for all SIP grammar elements that can have parameters.
ParserCategory & operator=(const ParserCategory &rhs)
Represents the "token" element in the RFC 3261 grammar.
virtual EncodeStream & encodeParsed(EncodeStream &str) const
virtual ParserCategory * clone() const
PrivacyCategory & operator=(const PrivacyCategory &)
const std::vector< Data > & value() const
virtual void parse(ParseBuffer &pb)
dcm! – add UnusedChecking(_enum) below;
static const Data parseContext("PrivacyCategory constructor")
#define EncodeStream