Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/filesystem/inifile.h')
-rw-r--r--src/filesystem/inifile.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/filesystem/inifile.h b/src/filesystem/inifile.h
index f064bc7..09f6ebb 100644
--- a/src/filesystem/inifile.h
+++ b/src/filesystem/inifile.h
@@ -12,7 +12,7 @@
#include "math/vector3f.h"
#include "math/color.h"
-#include "filesystem/file.h"
+#include "filesystem/filestream.h"
namespace filesystem {
@@ -23,13 +23,17 @@ namespace filesystem {
*/
class IniFile {
public:
- IniFile();
+ IniFile(const char *ininame = 0);
+
+ IniFile(std::string const & ininame);
+
~IniFile();
- /// open the file for reading
- /** the filename will get the "ini/" prefix and ".ini" suffix
- */
- bool open(std::string const & name);
+ /// open an ini file for reading
+ bool open(std::string const & ininame);
+
+ /// open an ini file for reading
+ bool open(const char *ininame);
/// parse one line, returns false on end-of-file
bool getline();
@@ -93,10 +97,16 @@ public:
void unknown_section() const;
/// return true of the ini file is open for reading
- inline bool is_open() { return inifile_ifs.is_open(); }
+ inline bool is_open() const { return inifile_stream.is_open(); }
- /// current filename
- inline std::string const & name() const {return inifile_name; }
+ /// return true of the ini file is open for reading
+ inline bool good() const { return inifile_stream.good(); }
+
+ /// current name in the virtual filesystem
+ inline std::string const & name() const {return inifile_stream.name(); }
+
+ /// current actual filename
+ inline std::string const & filename() const { return inifile_stream.filename(); }
/// close the file
void close();
@@ -110,8 +120,8 @@ private:
bool last_read_was_section;
unsigned int line_number;
- std::ifstream inifile_ifs;
- std::string inifile_name;
+
+ IFileStream inifile_stream;
};
}