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