/[resiprocate]/branches/b-directory-reorg/sip/resiprocate/Token.cxx
ViewVC logotype

Contents of /branches/b-directory-reorg/sip/resiprocate/Token.cxx

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27