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')
-rw-r--r--src/filesystem/inifile.cc21
-rw-r--r--src/filesystem/inifile.h8
2 files changed, 29 insertions, 0 deletions
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc
index e9ab283..8cf186c 100644
--- a/src/filesystem/inifile.cc
+++ b/src/filesystem/inifile.cc
@@ -159,6 +159,17 @@ bool IniFile::got_key_string(const char * keylabel, std::string & valuestring)
}
}
+bool IniFile::got_key_label(const char * keylabel, std::string & labelstring)
+{
+ if (last_read_was_key && (key_current.compare(keylabel) == 0)) {
+ labelstring.assign(value_current);
+ aux::to_label(labelstring);
+ return true;
+ } else {
+ return false;
+ }
+}
+
bool IniFile::got_key_vector3f(const char * keylabel, math::Vector3f & v)
{
if (last_read_was_key && (key_current.compare(keylabel) == 0)) {
@@ -298,6 +309,16 @@ void IniFile::unknown_section() const
con_warn << name() << " unknown section '" << section() << "' at line " << line() << std::endl;
}
+void IniFile::unknown_error(const char *text) const
+{
+ con_warn << name() << " " << (text && text[0] ? text : "unknown error") << " at line " << line() << std::endl;
+}
+
+void IniFile::unknown_error(const std::string &text) const
+{
+ con_warn << name() << " " << text << " at line " << line() << std::endl;
+}
+
void IniFile::close()
{
inifile_stream.close();
diff --git a/src/filesystem/inifile.h b/src/filesystem/inifile.h
index e5423aa..4b94dcd 100644
--- a/src/filesystem/inifile.h
+++ b/src/filesystem/inifile.h
@@ -72,6 +72,9 @@ public:
/// check if the last read key=value pair matches keylabel and store the value in valuestring
bool got_key_string(const char * keylabel, std::string & valuestring);
+ /// check if the last read key=value pair matches keylabel and store the value in valuestring, converted to label
+ bool got_key_label(const char * keylabel, std::string & labelstring);
+
bool got_key_color(const char * keylabel, math::Color & color);
bool got_key_float(const char * keylabel, float & f);
@@ -97,6 +100,11 @@ public:
/// print a default unkown section error
void unknown_section() const;
+
+ /// print a generic error message
+ void unknown_error(const char *text = 0) const;
+
+ void unknown_error(const std::string &text) const;
/// return true of the ini file is open for reading
inline bool is_open() {