reSIProcate/stack  9694
Rlmi.cxx
Go to the documentation of this file.
00001 #if defined(HAVE_CONFIG_H)
00002 #include "config.h"
00003 #endif
00004 
00005 #include "resip/stack/Rlmi.hxx"
00006 #include "resip/stack/SipMessage.hxx"
00007 #include "resip/stack/Symbols.hxx"
00008 #include "rutil/Logger.hxx"
00009 #include "rutil/ParseBuffer.hxx"
00010 #include "rutil/WinLeakCheck.hxx"
00011 
00012 using namespace resip;
00013 using namespace std;
00014 
00015 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
00016 
00017 bool
00018 Rlmi::init()
00019 {
00020    static ContentsFactory<Rlmi> factory;
00021    (void)factory;
00022    return true;
00023 }
00024 
00025 Rlmi::Rlmi()
00026    : Contents(getStaticType())
00027 {}
00028 
00029 Rlmi::Rlmi(const HeaderFieldValue& hfv, const Mime& contentsType)
00030    : Contents(hfv, contentsType)
00031 {
00032 }
00033  
00034 Rlmi::Rlmi(const Rlmi& rhs)
00035    : Contents(rhs)
00036 {
00037    mText = rhs.mText;
00038 }
00039 
00040 Rlmi::~Rlmi()
00041 {
00042 }
00043 
00044 Rlmi&
00045 Rlmi::operator=(const Rlmi& rhs)
00046 {
00047    if (this != &rhs)
00048    {
00049       mText = rhs.mText;
00050    }
00051    return *this;
00052 }
00053 
00054 Contents* 
00055 Rlmi::clone() const
00056 {
00057    return new Rlmi(*this);
00058 }
00059 
00060 const Mime& 
00061 Rlmi::getStaticType() 
00062 {
00063    static Mime type("application","rlmi+xml");
00064    return type;
00065 }
00066 
00067 EncodeStream& 
00068 Rlmi::encodeParsed(EncodeStream& str) const
00069 {
00070    //DebugLog(<< "Rlmi::encodeParsed " << mText);
00071    str << mText;
00072    
00073    return str;
00074 }
00075 
00076 void 
00077 Rlmi::parse(ParseBuffer& pb)
00078 {
00079    const char* anchor = pb.position();
00080    pb.skipToEnd();
00081    pb.data(mText, anchor);
00082 }
00083 
00084 const Data&
00085 Rlmi::get()
00086 {
00087    checkParsed();
00088    return mText;
00089 }
00090 
00091 void
00092 Rlmi::set(const Data& text)
00093 {
00094    mText = text;
00095 }
00096 
00097 /* ====================================================================
00098  * The Vovida Software License, Version 1.0 
00099  * 
00100  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00101  * 
00102  * Redistribution and use in source and binary forms, with or without
00103  * modification, are permitted provided that the following conditions
00104  * are met:
00105  * 
00106  * 1. Redistributions of source code must retain the above copyright
00107  *    notice, this list of conditions and the following disclaimer.
00108  * 
00109  * 2. Redistributions in binary form must reproduce the above copyright
00110  *    notice, this list of conditions and the following disclaimer in
00111  *    the documentation and/or other materials provided with the
00112  *    distribution.
00113  * 
00114  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00115  *    and "Vovida Open Communication Application Library (VOCAL)" must
00116  *    not be used to endorse or promote products derived from this
00117  *    software without prior written permission. For written
00118  *    permission, please contact vocal@vovida.org.
00119  *
00120  * 4. Products derived from this software may not be called "VOCAL", nor
00121  *    may "VOCAL" appear in their name, without prior written
00122  *    permission of Vovida Networks, Inc.
00123  * 
00124  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00125  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00126  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00127  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00128  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00129  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00130  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00131  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00132  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00133  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00134  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00135  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00136  * DAMAGE.
00137  * 
00138  * ====================================================================
00139  * 
00140  * This software consists of voluntary contributions made by Vovida
00141  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00142  * Inc.  For more information on Vovida Networks, Inc., please see
00143  * <http://www.vovida.org/>.
00144  *
00145  */