reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
CpimContents.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
7#include "rutil/Logger.hxx"
10
11
12using namespace resip;
13using namespace std;
14
15#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
16
17bool
19{
20 static ContentsFactory<CpimContents> factory;
21 (void)factory;
22 return true;
23}
24
26
28 : Contents(getStaticType()),
29 mText()
30{}
31
33 : Contents(getStaticType()),
34 mText(txt)
35{}
36
37CpimContents::CpimContents(const HeaderFieldValue& hfv, const Mime& contentsType)
38 : Contents(hfv, contentsType),
39 mText()
40{
41}
42
43CpimContents::CpimContents(const Data& txt, const Mime& contentsType)
44 : Contents(contentsType),
45 mText(txt)
46{
47}
48
50 : Contents(rhs),
51 mText(rhs.mText)
52{
53}
54
58
61{
62 if (this != &rhs)
63 {
65 mText = rhs.mText;
66 }
67 return *this;
68}
69
72{
73 return new CpimContents(*this);
74}
75
76const Mime&
78{
79 static Mime type("message","cpim");
80 return type;
81}
82
84CpimContents::encodeParsed(EncodeStream& str) const
85{
86 //DebugLog(<< "CpimContents::encodeParsed " << mText);
87 str << mText;
88 return str;
89}
90
91void
93{
94 //DebugLog(<< "CpimContents::parse: " << pb.position());
95
96 const char* anchor = pb.position();
97 pb.skipToEnd();
98 pb.data(mText, anchor);
99
100 //DebugLog("CpimContents::parsed <" << mText << ">" );
101}
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 */
Base class for all SIP body types.
Definition Contents.hxx:51
Contents & operator=(const Contents &rhs)
Assignment operator.
Definition Contents.cxx:71
SIP body type for holding CPIM (Common Profile for Instant Messaging) contents (MIME content-type mes...
virtual EncodeStream & encodeParsed(EncodeStream &str) const
virtual Contents * clone() const
duplicate an CpimContents object
static const CpimContents Empty
static const Mime & getStaticType()
virtual void parse(ParseBuffer &pb)
CpimContents & operator=(const CpimContents &rhs)
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipToEnd()
CurrentPosition position() const
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream