/[resiprocate]/main/sip/resiprocate/WarningCategory.cxx
ViewVC logotype

Contents of /main/sip/resiprocate/WarningCategory.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4599 - (show annotations) (download)
Wed May 11 23:10:19 2005 UTC (14 years, 7 months ago) by derek
File size: 4597 byte(s)
set svn:eol-style to LF
1 #if defined(HAVE_CONFIG_H)
2 #include "resiprocate/config.hxx"
3 #endif
4
5 #include "resiprocate/WarningCategory.hxx"
6 #include "resiprocate/os/Logger.hxx"
7 #include "resiprocate/os/ParseBuffer.hxx"
8 #include "resiprocate/os/WinLeakCheck.hxx"
9
10 using namespace resip;
11 using namespace std;
12
13 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
14
15 //====================
16 // WarningCategory
17 //====================
18 WarningCategory::WarningCategory()
19 : ParserCategory()
20 {}
21
22 WarningCategory::WarningCategory(HeaderFieldValue* hfv, Headers::Type type)
23 : ParserCategory(hfv, type)
24 {}
25
26 WarningCategory::WarningCategory(const WarningCategory& rhs)
27 : ParserCategory(rhs),
28 mCode(rhs.mCode),
29 mHostname(rhs.mHostname),
30 mText(rhs.mText)
31 {}
32
33 WarningCategory&
34 WarningCategory::operator=(const WarningCategory& rhs)
35 {
36 if (this != &rhs)
37 {
38 ParserCategory::operator=(rhs);
39 mCode = rhs.mCode;
40 mHostname = rhs.mHostname;
41 mText = rhs.mText;
42 }
43 return *this;
44 }
45 void
46 WarningCategory::parse(ParseBuffer& pb)
47 {
48 pb.skipWhitespace();
49 mCode = pb.integer();
50
51 const char* anchor = pb.skipWhitespace();
52 pb.skipNonWhitespace();
53 pb.data(mHostname, anchor);
54
55 pb.skipWhitespace();
56 anchor = pb.skipChar(Symbols::DOUBLE_QUOTE[0]);
57 pb.skipToEndQuote(Symbols::DOUBLE_QUOTE[0]);
58 pb.data(mText, anchor);
59 anchor = pb.skipChar(Symbols::DOUBLE_QUOTE[0]);
60 pb.skipWhitespace();
61 pb.assertEof();
62 }
63
64 ParserCategory*
65 WarningCategory::clone() const
66 {
67 return new WarningCategory(*this);
68 }
69
70 int&
71 WarningCategory::code()
72 {
73 checkParsed();
74 return mCode;
75 }
76
77 int
78 WarningCategory::code() const
79 {
80 checkParsed();
81 return mCode;
82 }
83
84 Data&
85 WarningCategory::hostname()
86 {
87 checkParsed();
88 return mHostname;
89 }
90
91 const Data&
92 WarningCategory::hostname() const
93 {
94 checkParsed();
95 return mHostname;
96 }
97
98 Data&
99 WarningCategory::text()
100 {
101 checkParsed();
102 return mText;
103 }
104
105 const Data&
106 WarningCategory::text() const
107 {
108 checkParsed();
109 return mText;
110 }
111
112 std::ostream&
113 WarningCategory::encodeParsed(std::ostream& str) const
114 {
115 str << mCode << Symbols::SPACE[0];
116 str << mHostname << Symbols::SPACE[0];
117 str << Symbols::DOUBLE_QUOTE[0] << mText << Symbols::DOUBLE_QUOTE[0];
118
119 return str;
120 }
121
122
123 /* ====================================================================
124 * The Vovida Software License, Version 1.0
125 *
126 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
127 *
128 * Redistribution and use in source and binary forms, with or without
129 * modification, are permitted provided that the following conditions
130 * are met:
131 *
132 * 1. Redistributions of source code must retain the above copyright
133 * notice, this list of conditions and the following disclaimer.
134 *
135 * 2. Redistributions in binary form must reproduce the above copyright
136 * notice, this list of conditions and the following disclaimer in
137 * the documentation and/or other materials provided with the
138 * distribution.
139 *
140 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
141 * and "Vovida Open Communication Application Library (VOCAL)" must
142 * not be used to endorse or promote products derived from this
143 * software without prior written permission. For written
144 * permission, please contact vocal@vovida.org.
145 *
146 * 4. Products derived from this software may not be called "VOCAL", nor
147 * may "VOCAL" appear in their name, without prior written
148 * permission of Vovida Networks, Inc.
149 *
150 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
151 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
152 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
153 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
154 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
155 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
156 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
157 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
158 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
159 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
160 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
161 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
162 * DAMAGE.
163 *
164 * ====================================================================
165 *
166 * This software consists of voluntary contributions made by Vovida
167 * Networks, Inc. and many individuals on behalf of Vovida Networks,
168 * Inc. For more information on Vovida Networks, Inc., please see
169 * <http://www.vovida.org/>.
170 *
171 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27