summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-08-12 13:57:16 -0600
committerJared Adams <jaxad0127@gmail.com>2010-08-12 14:00:20 -0600
commit2507a15f8cf8728e8006aec7cdef30e484612162 (patch)
treeee2edf1afca72ac2501dae701f2cc489f3afe301 /src
parentbdc14e11430b6c6538e6a2c721d22dabe83487e3 (diff)
downloadmana-client-2507a15f8cf8728e8006aec7cdef30e484612162.tar.gz
mana-client-2507a15f8cf8728e8006aec7cdef30e484612162.tar.bz2
mana-client-2507a15f8cf8728e8006aec7cdef30e484612162.tar.xz
mana-client-2507a15f8cf8728e8006aec7cdef30e484612162.zip
Fix some issues in the Event class
Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp8
-rw-r--r--src/event.h12
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;