summaryrefslogtreecommitdiff
path: root/src/depricatedevent.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-23 01:10:49 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-23 01:10:49 +0300
commit48c0b527f9b20827b06bd7f9abf669faf49487b7 (patch)
treef4837d522951d7fcfc2c5e513df361486885423b /src/depricatedevent.cpp
parent6c9e2b6ed9f67faab400f1876ada6e635f6abf9e (diff)
downloadmv-48c0b527f9b20827b06bd7f9abf669faf49487b7.tar.gz
mv-48c0b527f9b20827b06bd7f9abf669faf49487b7.tar.bz2
mv-48c0b527f9b20827b06bd7f9abf669faf49487b7.tar.xz
mv-48c0b527f9b20827b06bd7f9abf669faf49487b7.zip
remove useless code from depricatedevent class.
Diffstat (limited to 'src/depricatedevent.cpp')
-rw-r--r--src/depricatedevent.cpp41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/depricatedevent.cpp b/src/depricatedevent.cpp
index ad744839c..37826ac24 100644
--- a/src/depricatedevent.cpp
+++ b/src/depricatedevent.cpp
@@ -40,71 +40,68 @@ DepricatedEvent::~DepricatedEvent()
}
void DepricatedEvent::setInt(const std::string &key, const int value)
- throw (BadDepricatedEvent)
{
if (mData.find(key) != mData.end())
- throw KEY_ALREADY_EXISTS;
+ delete mData[key];
mData[key] = new IntData(value);
}
int DepricatedEvent::getInt(const std::string &key) const
- throw (BadDepricatedEvent)
{
const VariableMap::const_iterator it = mData.find(key);
if (it == mData.end())
- throw BAD_KEY;
+ return 0;
- if (!it->second || it->second->getType() != VariableData::DATA_INT)
- throw BAD_VALUE;
+ VariableData *const data = it->second;
+ if (!data || data->getType() != VariableData::DATA_INT)
+ return 0;
- return static_cast<IntData *>(it->second)->getData();
+ return static_cast<IntData *>(data)->getData();
}
void DepricatedEvent::setString(const std::string &key,
const std::string &value)
- throw (BadDepricatedEvent)
{
if (mData.find(key) != mData.end())
- throw KEY_ALREADY_EXISTS;
+ delete mData[key];
mData[key] = new StringData(value);
}
-const std::string &DepricatedEvent::getString(const std::string &key)
- const throw (BadDepricatedEvent)
+const std::string &DepricatedEvent::getString(const std::string &key) const
{
const VariableMap::const_iterator it = mData.find(key);
if (it == mData.end())
- throw BAD_KEY;
+ return "";
- if (!it->second || it->second->getType() != VariableData::DATA_STRING)
- throw BAD_VALUE;
+ VariableData *const data = it->second;
+ if (!data || data->getType() != VariableData::DATA_STRING)
+ return "";
- return static_cast<StringData *>(it->second)->getData();
+ return static_cast<StringData *>(data)->getData();
}
void DepricatedEvent::setFloat(const std::string &key, const double value)
- throw (BadDepricatedEvent)
{
if (mData.find(key) != mData.end())
- throw KEY_ALREADY_EXISTS;
+ delete mData[key];
mData[key] = new FloatData(value);
}
double DepricatedEvent::getFloat(const std::string &key) const
- throw (BadDepricatedEvent)
{
const VariableMap::const_iterator it = mData.find(key);
if (it == mData.end())
- throw BAD_KEY;
+ return 0;
- if (!it->second || it->second->getType() != VariableData::DATA_FLOAT)
- throw BAD_VALUE;
+ VariableData *const data = it->second;
+ if (!data || data->getType() != VariableData::DATA_FLOAT)
+ return 0;
- return static_cast<FloatData *>(it->second)->getData();
+ return static_cast<FloatData *>(data)->getData();
}
void DepricatedEvent::trigger(const Channels channel,