/[resiprocate]/branches/b-identity-0505/ExpiresCategory.cxx
ViewVC logotype

Contents of /branches/b-identity-0505/ExpiresCategory.cxx

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27