/src/resiprocate/resip/stack/ExistsOrDataParameter.cxx
Line | Count | Source |
1 | | #if defined(HAVE_CONFIG_H) |
2 | | #include "config.h" |
3 | | #endif |
4 | | |
5 | | #include "rutil/ResipAssert.h" |
6 | | #include "rutil/ParseException.hxx" |
7 | | #include "resip/stack/ExistsOrDataParameter.hxx" |
8 | | #include "resip/stack/Symbols.hxx" |
9 | | #include "rutil/Logger.hxx" |
10 | | #include "rutil/ParseBuffer.hxx" |
11 | | //#include "rutil/WinLeakCheck.hxx" // not compatible with placement new used below |
12 | | |
13 | | namespace resip |
14 | | { |
15 | | |
16 | | #define RESIPROCATE_SUBSYSTEM Subsystem::SIP |
17 | | |
18 | | |
19 | | ExistsOrDataParameter::ExistsOrDataParameter(ParameterTypes::Type type, bool) : |
20 | 0 | DataParameter(type) |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | | ExistsOrDataParameter::ExistsOrDataParameter(ParameterTypes::Type type, |
25 | | ParseBuffer& pb, |
26 | | const std::bitset<256>& terminators) |
27 | 618 | : DataParameter(type, pb, terminators) |
28 | 618 | { |
29 | 618 | } |
30 | | |
31 | | ExistsOrDataParameter::ExistsOrDataParameter(ParameterTypes::Type type) |
32 | 980 | : DataParameter(type) |
33 | 980 | { |
34 | 980 | } |
35 | | |
36 | | Parameter* |
37 | | ExistsOrDataParameter::decode(ParameterTypes::Type type, |
38 | | ParseBuffer& pb, |
39 | | const std::bitset<256>& terminators, |
40 | | PoolBase* pool) |
41 | 1.59k | { |
42 | | //pb.skipWhitespace(); // whitespace may be a terminator - don't skip it |
43 | 1.59k | if (pb.eof() || terminators[*pb.position()]) |
44 | 980 | { |
45 | 980 | return new (pool) ExistsOrDataParameter(type); |
46 | 980 | } |
47 | 618 | else |
48 | 618 | { |
49 | 618 | return new (pool) ExistsOrDataParameter(type, pb, terminators); |
50 | 618 | } |
51 | 1.59k | } |
52 | | |
53 | | Parameter* |
54 | | ExistsOrDataParameter::clone() const |
55 | 97 | { |
56 | 97 | return new ExistsOrDataParameter(*this); |
57 | 97 | } |
58 | | |
59 | | EncodeStream& |
60 | | ExistsOrDataParameter::encode(EncodeStream& stream) const |
61 | 0 | { |
62 | 0 | if (mValue.empty()) |
63 | 0 | { |
64 | 0 | return stream << getName(); |
65 | 0 | } |
66 | 0 | else |
67 | 0 | { |
68 | 0 | return DataParameter::encode(stream); |
69 | 0 | } |
70 | 0 | } |
71 | | |
72 | | } // namespace resip |