reSIProcate/stack  9694
MultipartMixedContents.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_MULTIPARTMIXEDCONTENTS_HXX)
00002 #define RESIP_MULTIPARTMIXEDCONTENTS_HXX 
00003 
00004 #include <vector>
00005 
00006 #include "resip/stack/Contents.hxx"
00007 #include "rutil/Data.hxx"
00008 
00009 namespace resip
00010 {
00011 
00012 class Mime;
00013 class ParseBuffer;
00014 
00019 class MultipartMixedContents : public Contents
00020 {
00021    public:
00022       MultipartMixedContents();
00023       explicit MultipartMixedContents(const Mime& contentType);
00024       MultipartMixedContents(const HeaderFieldValue& hfv, const Mime& contentType);
00025       MultipartMixedContents(const MultipartMixedContents& rhs);
00026       virtual ~MultipartMixedContents();
00027       MultipartMixedContents& operator=(const MultipartMixedContents& rhs);
00028 
00032       virtual Contents* clone() const;
00033 
00034       static const Mime& getStaticType() ;
00035 
00036       virtual EncodeStream& encodeParsed(EncodeStream& str) const;
00037       virtual void parse(ParseBuffer& pb);
00038 
00039       typedef std::vector<Contents*> Parts;
00040       Parts& parts() {checkParsed(); return mContents;}
00041       const Parts& parts() const {checkParsed(); return mContents;}
00042 
00043       void setBoundary(const Data& boundary);
00044 
00049       class Exception : public BaseException
00050       {
00051         public:
00052          Exception(const Data& msg, const Data& file, const int line)
00053             : BaseException(msg, file, line) {}
00054 
00055          const char* name() const { return "MultipartMixedContents::Exception"; }
00056       };
00057       
00058       static bool init();
00059       
00060    protected:
00061       void clear();
00062       
00063    private:
00064       void setBoundary();
00065       std::vector<Contents*> mContents;
00066 };
00067 
00068 static bool invokeMultipartMixedContentsInit = MultipartMixedContents::init();
00069 
00070 }
00071 
00072 #endif
00073 
00074 /* ====================================================================
00075  * The Vovida Software License, Version 1.0 
00076  * 
00077  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00078  * 
00079  * Redistribution and use in source and binary forms, with or without
00080  * modification, are permitted provided that the following conditions
00081  * are met:
00082  * 
00083  * 1. Redistributions of source code must retain the above copyright
00084  *    notice, this list of conditions and the following disclaimer.
00085  * 
00086  * 2. Redistributions in binary form must reproduce the above copyright
00087  *    notice, this list of conditions and the following disclaimer in
00088  *    the documentation and/or other materials provided with the
00089  *    distribution.
00090  * 
00091  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00092  *    and "Vovida Open Communication Application Library (VOCAL)" must
00093  *    not be used to endorse or promote products derived from this
00094  *    software without prior written permission. For written
00095  *    permission, please contact vocal@vovida.org.
00096  *
00097  * 4. Products derived from this software may not be called "VOCAL", nor
00098  *    may "VOCAL" appear in their name, without prior written
00099  *    permission of Vovida Networks, Inc.
00100  * 
00101  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00102  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00103  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00104  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00105  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00106  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00107  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00108  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00109  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00110  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00111  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00112  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00113  * DAMAGE.
00114  * 
00115  * ====================================================================
00116  * 
00117  * This software consists of voluntary contributions made by Vovida
00118  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00119  * Inc.  For more information on Vovida Networks, Inc., please see
00120  * <http://www.vovida.org/>.
00121  *
00122  */