diff options
-rw-r--r-- | src/event.cpp | 8 | ||||
-rw-r--r-- | src/event.h | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/event.cpp b/src/event.cpp index a2f233ac..dde04920 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -55,7 +55,7 @@ int Event::getInt(const std::string &key) const throw (BadEvent) return static_cast<IntData *>(it->second)->getData(); } -bool Event::hasInt(const std::string &key) +bool Event::hasInt(const std::string &key) const { VariableMap::const_iterator it = mData.find(key); return !(it == mData.end() @@ -83,7 +83,7 @@ const std::string &Event::getString(const std::string &key) const throw (BadEven } -bool Event::hasString(const std::string &key) +bool Event::hasString(const std::string &key) const { VariableMap::const_iterator it = mData.find(key); return !(it == mData.end() @@ -110,7 +110,7 @@ double Event::getFloat(const std::string &key) const throw (BadEvent) return static_cast<FloatData *>(it->second)->getData(); } -bool Event::hasFloat(const std::string &key) +bool Event::hasFloat(const std::string &key) const { VariableMap::const_iterator it = mData.find(key); return !(it == mData.end() @@ -137,7 +137,7 @@ bool Event::getBool(const std::string &key) const throw (BadEvent) return static_cast<BoolData *>(it->second)->getData(); } -bool Event::hasBool(const std::string &key) +bool Event::hasBool(const std::string &key) const { VariableMap::const_iterator it = mData.find(key); return !(it == mData.end() diff --git a/src/event.h b/src/event.h index 7acd2190..b27b9c33 100644 --- a/src/event.h +++ b/src/event.h @@ -74,7 +74,7 @@ public: /** * Returns true if the given variable exists and is an integer. */ - bool hasInt(const std::string &key); + bool hasInt(const std::string &key) const; /** * Sets the given variable to the given string, if it isn't already set. @@ -90,14 +90,14 @@ public: * Returns the given variable if it is set and a string, returning the * given default otherwise. */ - inline const std::string &getString(const std::string &key, - const std::string &defaultValue) const + inline std::string getString(const std::string &key, + const std::string &defaultValue) const { try { return getString(key); } catch (BadEvent) { return defaultValue; }} /** * Returns true if the given variable exists and is a string. */ - bool hasString(const std::string &key); + bool hasString(const std::string &key) const; /** * Sets the given variable to the given floating-point, if it isn't already @@ -120,7 +120,7 @@ public: /** * Returns true if the given variable exists and is a floating-point. */ - bool hasFloat(const std::string &key); + bool hasFloat(const std::string &key) const; /** * Sets the given variable to the given boolean, if it isn't already set. @@ -142,7 +142,7 @@ public: /** * Returns true if the given variable exists and is a boolean. */ - bool hasBool(const std::string &key); + bool hasBool(const std::string &key) const; private: std::string mEventName; |