From 43f7733dfdd8700430a238d230ed573c12e72c87 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 8 Feb 2009 13:12:41 +0000 Subject: added filesystem::FileStream --- src/filesystem/filestream.h | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/filesystem/filestream.h (limited to 'src/filesystem/filestream.h') diff --git a/src/filesystem/filestream.h b/src/filesystem/filestream.h new file mode 100644 index 0000000..7dddda9 --- /dev/null +++ b/src/filesystem/filestream.h @@ -0,0 +1,70 @@ +/* + filesystem/ifilestream.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_FILESYSTEM_FILESTREAM_H__ +#define __INCLUDED_FILESYSTEM_FILESTREAM_H__ + +#include + +namespace filesystem +{ + +/** + * @brief input stream for files in the virtual filesystem + */ +class IFileStream : public std::ifstream +{ +public: + IFileStream(const char *name); + + IFileStream(const std::string &name); + + void open(const char *name); + + void open(const std::string &name); + + /// name of the file in the virtual filesystem + inline const std::string &name() { return fstream_name; } + + /// system filename + inline const std::string &filename() { return fstream_filename; } + +private: + std::string fstream_name; + std::string fstream_filename; +}; + +/** + * @brief output stream for files in the home directory + */ +/* +class OFileStream : public std::ofstream +{ +public: + IFileStream(const char *filename); + + IFileStream(const std::string &filename); + + void open(const char *filename); + + void open(const std::string &filename); + + /// name of the file in the virtual filesystem + inline const std::string &name() { return fstream_name; } + + /// system filename + inline const std::string &filename() { return fstream_filename; } + +private: + std::string fstream_name; + std::string fstream_filename; +}; +*/ + +} // namespace filesystem + +#endif // __INCLUDED_FILESYSTEM_FILESTREAM_H__ + -- cgit v1.2.3