/src/resiprocate/resip/stack/StringCategory.cxx
Line | Count | Source (jump to first uncovered line) |
1 | | #if defined(HAVE_CONFIG_H) |
2 | | #include "config.h" |
3 | | #endif |
4 | | |
5 | | #include "resip/stack/StringCategory.hxx" |
6 | | #include "rutil/Logger.hxx" |
7 | | #include "rutil/ParseBuffer.hxx" |
8 | | //#include "rutil/WinLeakCheck.hxx" // not compatible with placement new used below |
9 | | |
10 | | using namespace resip; |
11 | | using namespace std; |
12 | | |
13 | | #define RESIPROCATE_SUBSYSTEM Subsystem::SIP |
14 | | |
15 | | //==================== |
16 | | // StringCategory |
17 | | //==================== |
18 | | StringCategory::StringCategory() : |
19 | | ParserCategory(), |
20 | | mValue() |
21 | 0 | {} |
22 | | |
23 | | StringCategory::StringCategory(const Data& value) |
24 | | : ParserCategory(), |
25 | | mValue(value) |
26 | 0 | {} |
27 | | |
28 | | StringCategory::StringCategory(const HeaderFieldValue& hfv, |
29 | | Headers::Type type, |
30 | | PoolBase* pool) |
31 | | : ParserCategory(hfv, type, pool), |
32 | | mValue() |
33 | 0 | {} |
34 | | |
35 | | StringCategory::StringCategory(const StringCategory& rhs, |
36 | | PoolBase* pool) |
37 | | : ParserCategory(rhs, pool), |
38 | | mValue(rhs.mValue) |
39 | 0 | {} |
40 | | |
41 | | StringCategory& |
42 | | StringCategory::operator=(const StringCategory& rhs) |
43 | 0 | { |
44 | 0 | if (this != &rhs) |
45 | 0 | { |
46 | 0 | ParserCategory::operator=(rhs); |
47 | 0 | mValue = rhs.mValue; |
48 | 0 | } |
49 | 0 | return *this; |
50 | 0 | } |
51 | | ParserCategory* |
52 | | StringCategory::clone() const |
53 | 0 | { |
54 | 0 | return new StringCategory(*this); |
55 | 0 | } |
56 | | |
57 | | ParserCategory* |
58 | | StringCategory::clone(void* location) const |
59 | 0 | { |
60 | 0 | return new (location) StringCategory(*this); |
61 | 0 | } |
62 | | |
63 | | ParserCategory* |
64 | | StringCategory::clone(PoolBase* pool) const |
65 | 0 | { |
66 | 0 | return new (pool) StringCategory(*this, pool); |
67 | 0 | } |
68 | | |
69 | | void |
70 | | StringCategory::parse(ParseBuffer& pb) |
71 | 0 | { |
72 | 0 | const char* anchor = pb.position(); |
73 | 0 | pb.skipToEnd(); |
74 | 0 | pb.data(mValue, anchor); |
75 | 0 | } |
76 | | |
77 | | EncodeStream& |
78 | | StringCategory::encodeParsed(EncodeStream& str) const |
79 | 0 | { |
80 | 0 | str << mValue; |
81 | 0 | return str; |
82 | 0 | } |
83 | | |
84 | | const Data& |
85 | | StringCategory::value() const |
86 | 0 | { |
87 | 0 | checkParsed(); |
88 | 0 | return mValue; |
89 | 0 | } |
90 | | |
91 | | Data& |
92 | | StringCategory::value() |
93 | 0 | { |
94 | 0 | checkParsed(); |
95 | 0 | return mValue; |
96 | 0 | } |
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 | | */ |