GNU CommonC++
mime.h
Go to the documentation of this file.
1// Copyright (C) 2001-2005 Open Source Telecom Corporation.
2// Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
3//
4// This program is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17//
18// As a special exception, you may use this file as part of a free software
19// library without restriction. Specifically, if other files instantiate
20// templates or use macros or inline functions from this file, or you compile
21// this file and link it with other files to produce an executable, this
22// file does not by itself cause the resulting executable to be covered by
23// the GNU General Public License. This exception does not however
24// invalidate any other reasons why the executable file might be covered by
25// the GNU General Public License.
26//
27// This exception applies only to the code released under the name GNU
28// Common C++. If you copy code from other releases into a copy of GNU
29// Common C++, as the General Public License permits, the exception does
30// not apply to the code that you add in this way. To avoid misleading
31// anyone as to the status of such modified files, you must delete
32// this exception notice from them.
33//
34// If you write modifications of your own for GNU Common C++, it is your choice
35// whether to permit this exception to apply to your modifications.
36// If you do not wish that, delete this exception notice.
37//
38
44#ifndef CCXX_MIME_H_
45#define CCXX_MIME_H_
46
47#ifndef CCXX_CONFIG_H_
48#include <cc++/config.h>
49#endif
50
51#ifndef CCXX_SOCKET_H_
52#include <cc++/socket.h>
53#endif
54
55#ifdef CCXX_NAMESPACES
56namespace ost {
57#endif
58
61
70{
71protected:
72 friend class __EXPORT MIMEItemPart;
73 char boundry[8];
74 char mtype[80];
75 char *header[16];
77
78 virtual ~MIMEMultipart();
79
80public:
86 MIMEMultipart(const char *document);
87
94 virtual void head(std::ostream *output);
95
102 virtual void body(std::ostream *output);
103
110 char **getHeaders(void)
111 {return header;};
112};
113
123{
124protected:
126
127public:
133};
134
144{
145protected:
147
150 const char *ctype;
151
157 virtual void head(std::ostream *output);
158
164 virtual void body(std::ostream *output) = 0;
165
172 MIMEItemPart(MIMEMultipart *top, const char *ct);
173
174 virtual ~MIMEItemPart();
175};
176
185{
186protected:
187 const char *content;
188 const char *name;
189
190 virtual ~MIMEFormData();
191
192public:
198 void head(std::ostream *output);
199
205 void body(std::ostream *output);
206
214 MIMEFormData(MIMEMultipartForm *top, const char *name, const char *content);
215};
216
217#ifdef CCXX_NAMESPACES
218}
219#endif
220
221#endif
This is a document part type for use in submitting multipart form data to a web server.
Definition mime.h:185
MIMEFormData(MIMEMultipartForm *top, const char *name, const char *content)
Construct form data field part of multipart form.
virtual ~MIMEFormData()
void head(std::ostream *output)
Stream header, Content-Disposition form-data.
const char * name
Definition mime.h:188
const char * content
Definition mime.h:187
void body(std::ostream *output)
Stream content (value) of this form data field.
This is used to attach an item part to a MIME multipart document that is being streamed.
Definition mime.h:144
virtual void body(std::ostream *output)=0
Stream the content of this document part.
MIMEItemPart(MIMEMultipart *top, const char *ct)
Construct and attach a document part to a multipart document.
virtual ~MIMEItemPart()
virtual void head(std::ostream *output)
Stream the header(s) for the current document part.
const char * ctype
Definition mime.h:150
MIMEItemPart * next
Definition mime.h:149
MIMEMultipart * base
Definition mime.h:148
The Multipart form is a MIME multipart document specific for the construction and delivery of form da...
Definition mime.h:123
MIMEMultipartForm()
Construct a form result.
virtual ~MIMEMultipartForm()
A container class for multi-part MIME document objects which can be streamed to a std::ostream destin...
Definition mime.h:70
MIMEMultipart(const char *document)
Contruct a multi-part document, and describe it's type.
char ** getHeaders(void)
Get a string array of the headers to use.
Definition mime.h:110
virtual void body(std::ostream *output)
Stream the "body" of the multi-part document.
virtual void head(std::ostream *output)
Stream the headers of the multi-part document.
MIMEItemPart * first
Definition mime.h:76
virtual ~MIMEMultipart()
#define __EXPORT
Definition config.h:1045
Definition address.h:64
Network addresses and sockets related classes.