UCommon
|
00001 // Copyright (C) 2001-2005 Open Source Telecom Corporation. 00002 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks. 00003 // Copyright (C) 2015 Cherokees of Idaho. 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 // As a special exception, you may use this file as part of a free software 00019 // library without restriction. Specifically, if other files instantiate 00020 // templates or use macros or inline functions from this file, or you compile 00021 // this file and link it with other files to produce an executable, this 00022 // file does not by itself cause the resulting executable to be covered by 00023 // the GNU General Public License. This exception does not however 00024 // invalidate any other reasons why the executable file might be covered by 00025 // the GNU General Public License. 00026 // 00027 // This exception applies only to the code released under the name GNU 00028 // Common C++. If you copy code from other releases into a copy of GNU 00029 // Common C++, as the General Public License permits, the exception does 00030 // not apply to the code that you add in this way. To avoid misleading 00031 // anyone as to the status of such modified files, you must delete 00032 // this exception notice from them. 00033 // 00034 // If you write modifications of your own for GNU Common C++, it is your choice 00035 // whether to permit this exception to apply to your modifications. 00036 // If you do not wish that, delete this exception notice. 00037 // 00038 00044 #ifndef COMMONCPP_MIME_H_ 00045 #define COMMONCPP_MIME_H_ 00046 00047 #ifndef COMMONCPP_CONFIG_H_ 00048 #include <commoncpp/config.h> 00049 #endif 00050 00051 #ifndef COMMONCPP_SOCKET_H_ 00052 #include <commoncpp/socket.h> 00053 #endif 00054 00055 namespace ost { 00056 00057 class MIMEMultipart; 00058 class MIMEItemPart; 00059 00067 class __EXPORT MIMEMultipart 00068 { 00069 protected: 00070 friend class MIMEItemPart; 00071 char boundry[8]; 00072 char mtype[80]; 00073 char *header[16]; 00074 MIMEItemPart *first, *last; 00075 00076 virtual ~MIMEMultipart(); 00077 00078 public: 00084 MIMEMultipart(const char *document); 00085 00092 virtual void head(std::ostream *output); 00093 00100 virtual void body(std::ostream *output); 00101 00108 char **getHeaders(void) 00109 {return header;} 00110 }; 00111 00120 class __EXPORT MIMEMultipartForm : public MIMEMultipart 00121 { 00122 protected: 00123 virtual ~MIMEMultipartForm(); 00124 00125 public: 00130 MIMEMultipartForm(); 00131 }; 00132 00141 class __EXPORT MIMEItemPart 00142 { 00143 protected: 00144 friend class MIMEMultipart; 00145 00146 MIMEMultipart *base; 00147 MIMEItemPart *next; 00148 const char *ctype; 00149 00155 virtual void head(std::ostream *output); 00156 00162 virtual void body(std::ostream *output) = 0; 00163 00170 MIMEItemPart(MIMEMultipart *top, const char *ct); 00171 00172 virtual ~MIMEItemPart(); 00173 }; 00174 00182 class __EXPORT MIMEFormData : public MIMEItemPart 00183 { 00184 protected: 00185 const char *content; 00186 const char *name; 00187 00188 virtual ~MIMEFormData(); 00189 00190 public: 00196 void head(std::ostream *output); 00197 00203 void body(std::ostream *output); 00204 00212 MIMEFormData(MIMEMultipartForm *top, const char *name, const char *content); 00213 }; 00214 00215 } // namespace ost 00216 00217 #endif