Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

filestream.h

Go to the documentation of this file.
00001 /*
00002     Ishtar - A network transparent read/write interface with
00003     probing and enumeration support.
00004     network part : convenient cross-platform packaging for tcp/ip networking
00005     Copyright (C) 2003-2005 Stephane Magnenat <nct@ysagoon.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 */
00021 
00022 #ifndef __ISHTAR_FILESTREAM_H
00023 #define __ISHTAR_FILESTREAM_H
00024  
00025 #include "stream.h"
00026 #include <fstream>
00027 
00032 namespace Ishtar
00033 {
00035     class FileOutputStream:public Ishtar::OutputStream
00036     {
00037     protected:
00038         std::ofstream stream; 
00039         
00040     public:
00042         FileOutputStream(const std::string &filename, std::ios_base::openmode mode = std::ios_base::out | std::ios_base::trunc );
00043         virtual ~FileOutputStream();
00044         virtual void write(const void *data, const Size size);
00045         virtual void flush(void);
00047         operator bool () { return static_cast<bool>(stream); }
00048     };
00049     
00051     class FileInputStream:public Ishtar::InputStream
00052     {
00053     protected:
00054         std::ifstream stream; 
00055         
00056     public:
00058         FileInputStream(const std::string &filename, std::ios_base::openmode mode = std::ios_base::in );
00059         virtual ~FileInputStream();
00060         virtual void read(void *data, Size size);
00062         operator bool () { return static_cast<bool>(stream); }
00063     };
00064 }
00065  
00066 #endif

Generated on Mon Oct 24 17:30:54 2005 for libishtarnet by  doxygen 1.4.2