From 43a28f04fa3ddf4b612f58c25a896293a01567e3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 15 Oct 2011 02:28:57 +0300 Subject: mobv2 --- src/settings.h | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'src/settings.h') diff --git a/src/settings.h b/src/settings.h index f972ce3ec..e8f376938 100644 --- a/src/settings.h +++ b/src/settings.h @@ -102,6 +102,22 @@ public: return true; } + void parseConfigLines(std::istream &is, const std::string &endstring) + { + for(;;){ + if(is.eof()) + break; + std::string line; + std::getline(is, line); + std::string trimmedline = trim(line); + if(endstring != ""){ + if(trimmedline == endstring) + break; + } + parseConfigLine(line); + } + } + // Returns false on EOF bool parseConfigObject(std::istream &is) { @@ -481,6 +497,16 @@ public: return value; } + v2f getV2F(std::string name) + { + v2f value; + Strfnd f(get(name)); + f.next("("); + value.X = stof(f.next(",")); + value.Y = stof(f.next(")")); + return value; + } + u64 getU64(std::string name) { u64 value = 0; @@ -515,6 +541,13 @@ public: set(name, os.str()); } + void setV2F(std::string name, v2f value) + { + std::ostringstream os; + os<<"("<::Iterator + i = other.m_settings.getIterator(); + i.atEnd() == false; i++) + { + m_settings[i.getNode()->getKey()] = i.getNode()->getValue(); + } + + for(core::map::Iterator + i = other.m_defaults.getIterator(); + i.atEnd() == false; i++) + { + m_defaults[i.getNode()->getKey()] = i.getNode()->getValue(); + } + + return; + } + Settings & operator+=(Settings &other) { JMutexAutoLock lock(m_mutex); -- cgit v1.2.3