cgicc: FormFile.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# FormFile.h

Go to the documentation of this file.

    00001 /* -*-mode:c++; c-file-style: "gnu";-*- */
    00002 /*
    00003  *  $Id: FormFile.h,v 1.11 2007/07/02 18:48:18 sebdiaz Exp $
    00004  *
    00005  *  Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
    00006  *                       2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
    00007  *  Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU Lesser General Public
    00011  *  License as published by the Free Software Foundation; either
    00012  *  version 3 of the License, or (at your option) any later version.
    00013  *
    00014  *  This library is distributed in the hope that it will be useful,
    00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00017  *  Lesser General Public License for more details.
    00018  *
    00019  *  You should have received a copy of the GNU Lesser General Public
    00020  *  License along with this library; if not, write to the Free Software
    00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
    00022  */
    00023
    00024 #ifndef _FORMFILE_H_
    00025 #define _FORMFILE_H_ 1
    00026
    00027 #ifdef __GNUG__
    00028 #  pragma interface
    00029 #endif
    00030
    00040 #include <iostream>
    00041 #include <string>
    00042
    00043 #include "cgicc/CgiDefs.h"
    00044
    00045 namespace cgicc {
    00046
    00047   // ============================================================
    00048   // Class FormFile
    00049   // ============================================================
    00050
    00064   class CGICC_API FormFile
    00065   {
    00066   public:
    00067
    00068     // ============================================================
    00069
    00072
    00078     inline
    00079     FormFile()
    00080     {}
    00081
    00091     FormFile(const std::string& name,
    00092              const std::string& filename,
    00093              const std::string& dataType,
    00094              const std::string& data);
    00095
    00102     inline
    00103     FormFile(const FormFile& file)
    00104     { operator=(file); }
    00105
    00111     inline
    00112     ~FormFile()
    00113     {}
    00115
    00116     // ============================================================
    00117
    00120
    00128     bool
    00129     operator== (const FormFile& file)                   const;
    00130
    00138     inline bool
    00139     operator!= (const FormFile& file)                   const
    00140     { return ! operator==(file); }
    00141
    00142 #ifdef WIN32
    00143     /* Dummy operator for MSVC++ */
    00144     inline bool
    00145     operator< (const FormFile& file)                    const
    00146     { return false; }
    00147 #endif
    00148
    00156     FormFile&
    00157     operator= (const FormFile& file);
    00159
    00160     // ============================================================
    00161
    00166
    00173     void
    00174     writeToStream(std::ostream& out)                    const;
    00175
    00183     inline std::string
    00184     getName()                                           const
    00185     { return fName; }
    00186
    00193     inline std::string
    00194     getFilename()                                       const
    00195     { return fFilename; }
    00196
    00203     inline std::string
    00204     getDataType()                                       const
    00205     { return fDataType; }
    00206
    00213     inline std::string
    00214     getData()                                   const
    00215     { return fData; }
    00216
    00223     inline std::string::size_type
    00224     getDataLength()                             const
    00225     { return fData.length(); }
    00227
    00228   private:
    00229     std::string         fName;
    00230     std::string         fFilename;
    00231     std::string         fDataType;
    00232     std::string         fData;
    00233   };
    00234
    00235 } // namespace cgicc
    00236
    00237 #endif /* ! _FORMFILE_H_ */