reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
StringCategory.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
6#include "rutil/Logger.hxx"
8//#include "rutil/WinLeakCheck.hxx" // not compatible with placement new used below
9
10using namespace resip;
11using namespace std;
12
13#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
14
15//====================
16// StringCategory
17//====================
22
25 mValue(value)
26{}
27
29 Headers::Type type,
30 PoolBase* pool)
31 : ParserCategory(hfv, type, pool),
32 mValue()
33{}
34
36 PoolBase* pool)
37 : ParserCategory(rhs, pool),
38 mValue(rhs.mValue)
39{}
40
43{
44 if (this != &rhs)
45 {
47 mValue = rhs.mValue;
48 }
49 return *this;
50}
53{
54 return new StringCategory(*this);
55}
56
58StringCategory::clone(void* location) const
59{
60 return new (location) StringCategory(*this);
61}
62
65{
66 return new (pool) StringCategory(*this, pool);
67}
68
69void
71{
72 const char* anchor = pb.position();
73 pb.skipToEnd();
74 pb.data(mValue, anchor);
75}
76
78StringCategory::encodeParsed(EncodeStream& str) const
79{
80 str << mValue;
81 return str;
82}
83
84const Data&
86{
87 checkParsed();
88 return mValue;
89}
90
91Data&
93{
94 checkParsed();
95 return mValue;
96}
97
98/* ====================================================================
99 * The Vovida Software License, Version 1.0
100 *
101 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
102 *
103 * Redistribution and use in source and binary forms, with or without
104 * modification, are permitted provided that the following conditions
105 * are met:
106 *
107 * 1. Redistributions of source code must retain the above copyright
108 * notice, this list of conditions and the following disclaimer.
109 *
110 * 2. Redistributions in binary form must reproduce the above copyright
111 * notice, this list of conditions and the following disclaimer in
112 * the documentation and/or other materials provided with the
113 * distribution.
114 *
115 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
116 * and "Vovida Open Communication Application Library (VOCAL)" must
117 * not be used to endorse or promote products derived from this
118 * software without prior written permission. For written
119 * permission, please contact vocal@vovida.org.
120 *
121 * 4. Products derived from this software may not be called "VOCAL", nor
122 * may "VOCAL" appear in their name, without prior written
123 * permission of Vovida Networks, Inc.
124 *
125 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
126 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
127 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
128 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
129 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
130 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
131 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
132 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
133 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
134 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
135 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
136 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
137 * DAMAGE.
138 *
139 * ====================================================================
140 *
141 * This software consists of voluntary contributions made by Vovida
142 * Networks, Inc. and many individuals on behalf of Vovida Networks,
143 * Inc. For more information on Vovida Networks, Inc., please see
144 * <http://www.vovida.org/>.
145 *
146 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
void checkParsed() const
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipToEnd()
CurrentPosition position() const
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
Base class for all SIP grammar elements that can have parameters.
ParserCategory & operator=(const ParserCategory &rhs)
Represents the "header-value" element in the RFC 3261 grammar (ie, an unknown header field value).
virtual ParserCategory * clone() const
virtual void parse(ParseBuffer &pb)
const Data & value() const
virtual EncodeStream & encodeParsed(EncodeStream &str) const
StringCategory & operator=(const StringCategory &)
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream