/* filesystem/filestream.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 = 0); 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() const { return ifstream_name; } /// name of the file in the real filesystem inline const std::string &filename() const { return ifstream_filename; } private: std::string ifstream_name; std::string ifstream_filename; }; /** * @brief output stream for files in the home directory */ class OFileStream : public std::ofstream { public: OFileStream(const char name = 0); OFileStream(const char *name); OFileStream(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 ofstream_name; } /// name of the file in the real filesystem inline const std::string &filename() { return ofstream_filename; } private: std::string ofstream_name; std::string ofstream_filename; }; } // namespace filesystem #endif // __INCLUDED_FILESYSTEM_FILESTREAM_H__