Skip to content

Commit

Permalink
Add support for boolean parameters (fix #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgromov committed Sep 3, 2013
1 parent f2e2e7f commit a8455d7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions include/filters/filter_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,27 @@ class FilterBase
return true;
}

/** \brief Get a filter parameter as a boolean
* \param name The name of the parameter
* \param value The boolean to set with the value
* \return Whether or not the parameter of name/type was set */
bool getParam(const std::string& name, bool& value)
{
string_map_t::iterator it = params_.find(name);
if (it == params_.end())
{
return false;
}

if(it->second.getType() != XmlRpc::XmlRpcValue::TypeBoolean)
{
return false;
}

value = (bool)(it->second);
return true;
}

/** \brief Get a filter parameter as a double
* \param name The name of the parameter
* \param value The double to set with the value
Expand Down

0 comments on commit a8455d7

Please sign in to comment.