00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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