FormFile.h
Go to the documentation of this file.
1/* -*-mode:c++; c-file-style: "gnu";-*- */
2/*
3 * $Id: FormFile.h,v 1.12 2014/04/23 20:55:04 sebdiaz Exp $
4 *
5 * Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
6 * 2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
7 * Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 3 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
22 */
23
24#ifndef _FORMFILE_H_
25#define _FORMFILE_H_ 1
26
27#ifdef __GNUG__
28# pragma interface
29#endif
30
40#include <iostream>
41#include <string>
42
43#include "CgiDefs.h"
44
45namespace cgicc {
46
47 // ============================================================
48 // Class FormFile
49 // ============================================================
50
64 class CGICC_API FormFile
65 {
66 public:
67
68 // ============================================================
69
72
78 inline
80 {}
81
91 FormFile(const std::string& name,
92 const std::string& filename,
93 const std::string& dataType,
94 const std::string& data);
95
102 inline
103 FormFile(const FormFile& file)
104 { operator=(file); }
105
111 inline
113 {}
115
116 // ============================================================
117
120
128 bool
129 operator== (const FormFile& file) const;
130
138 inline bool
139 operator!= (const FormFile& file) const
140 { return ! operator==(file); }
141
142#ifdef WIN32
143 /* Dummy operator for MSVC++ */
144 inline bool
145 operator< (const FormFile& file) const
146 { return false; }
147#endif
148
156 FormFile&
157 operator= (const FormFile& file);
159
160 // ============================================================
161
166
173 void
174 writeToStream(std::ostream& out) const;
175
183 inline std::string
184 getName() const
185 { return fName; }
186
193 inline std::string
195 { return fFilename; }
196
203 inline std::string
205 { return fDataType; }
206
213 inline std::string
214 getData() const
215 { return fData; }
216
223 inline std::string::size_type
225 { return fData.length(); }
227
228 private:
229 std::string fName;
230 std::string fFilename;
231 std::string fDataType;
232 std::string fData;
233 };
234
235} // namespace cgicc
236
237#endif /* ! _FORMFILE_H_ */
Platform and operating system specific macro definitions.
Class representing a file submitted via an HTML form.
Definition: FormFile.h:65
std::string getFilename() const
Get the basename of the file on the remote machine.
Definition: FormFile.h:194
std::string getDataType() const
Get the MIME type of the file data.
Definition: FormFile.h:204
std::string getName() const
Get the name of the form element.
Definition: FormFile.h:184
FormFile(const std::string &name, const std::string &filename, const std::string &dataType, const std::string &data)
Create a new FormFile.
void writeToStream(std::ostream &out) const
Write this file data to the specified stream.
FormFile()
Default constructor.
Definition: FormFile.h:79
std::string getData() const
Get the file data.
Definition: FormFile.h:214
std::string::size_type getDataLength() const
Get the length of the file data.
Definition: FormFile.h:224
FormFile(const FormFile &file)
Copy constructor.
Definition: FormFile.h:103
~FormFile()
Destructor.
Definition: FormFile.h:112
The namespace containing the cgicc library.
Definition: Cgicc.h:52

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Fri Mar 1 2024 08:39:41 for cgicc by doxygen 1.9.6