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