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