diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-04 22:30:49 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-04 22:30:49 +0000 |
commit | 7218e3bd4616d4706090ec47d72845a2bb89c6a3 (patch) | |
tree | cbf3fdb0dddf573edff89b50af22e8a84690cf00 /src/filesystem | |
parent | 33e45d8052b385aa8b1fce68122c8d11f50e7e42 (diff) |
split map reading from models
Diffstat (limited to 'src/filesystem')
-rw-r--r-- | src/filesystem/inifile.cc | 8 | ||||
-rw-r--r-- | src/filesystem/inifile.h | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc index d9f2839..337cf45 100644 --- a/src/filesystem/inifile.cc +++ b/src/filesystem/inifile.cc @@ -16,7 +16,7 @@ IniFile::IniFile() {} IniFile::~IniFile() {} -void IniFile::open(std::string const & name) { +bool IniFile::open(std::string const & name) { last_read_was_section = false; last_read_was_key = false; @@ -32,7 +32,7 @@ void IniFile::open(std::string const & name) { filesystem::File *f = filesystem::open(inifile_name.c_str()); if (!f) { con_warn << "Could not open " << inifile_name << std::endl; - return; + return false; } std::string fn = f->path(); @@ -42,8 +42,10 @@ void IniFile::open(std::string const & name) { inifile_ifs.open(fn.c_str()); if (!inifile_ifs.is_open()) { con_warn << "Could not stream " << fn << "!\n"; - return; + return false; } + + return true; } diff --git a/src/filesystem/inifile.h b/src/filesystem/inifile.h index 6503053..f5c903d 100644 --- a/src/filesystem/inifile.h +++ b/src/filesystem/inifile.h @@ -24,13 +24,14 @@ namespace filesystem { class IniFile { public: IniFile(); - virtual ~IniFile(); + ~IniFile(); /// open the file for reading /** the filename will get the "ini/" prefix and ".ini" suffix */ - virtual void open(std::string const & name); + bool open(std::string const & name); + /// parse one line, returns false on end-of-file bool getline(); /// current section label |