diff options
author | Stijn Buys <ingar@osirion.org> | 2009-02-08 13:12:41 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2009-02-08 13:12:41 +0000 |
commit | 43f7733dfdd8700430a238d230ed573c12e72c87 (patch) | |
tree | a3fd4dea40ae291ee8bed1dfb3472324e1657fe0 /src/filesystem/filestream.h | |
parent | 48892cf81a5ef06103286947b2eb55c7c46681a4 (diff) |
added filesystem::FileStream
Diffstat (limited to 'src/filesystem/filestream.h')
-rw-r--r-- | src/filesystem/filestream.h | 70 |
1 files changed, 70 insertions, 0 deletions
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 <fstream> + +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__ + |