Skip to content
Snippets Groups Projects
Commit 9650bf7f authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Renamed removing variable method to del_variable.

parent fb6645c2
Branches
No related merge requests found
......@@ -22,7 +22,7 @@ struct delhelper
template<typename T>
void operator()(const boost::mpl::always<T>&) {
r = v.del<T>(s) || r;
r = v.del_variable<T>(s) || r;
}
};
} /* end anon ns */
......
......@@ -339,11 +339,11 @@ public:
* @returns true if the variable was removed, false otherwise
*/
template<typename T>
bool del(const std::string& s);
bool del_variable(const std::string& s);
/** Remove a variable regardless of it's type.
*
* Prefer del<T> with a concrete T as it will be faster.
* Prefer del_variable<T> with a concrete T as it will be faster.
*
* @returns true if the variable was removed, false otherwise
*/
......@@ -435,7 +435,7 @@ void Variables::put(const std::string& s, const boost::shared_ptr<T>& v) {
}
template<typename T> inline
bool Variables::del(const std::string &s)
bool Variables::del_variable(const std::string &s)
{
BOOST_MPL_ASSERT(( boost::mpl::count<types, T> ));
if (detail::Vmap<T>::map_.erase(s)) {
......@@ -448,7 +448,7 @@ bool Variables::del(const std::string &s)
}
template<> inline
bool Variables::del<Value>(const std::string &s)
bool Variables::del_variable<Value>(const std::string &s)
{
return del_any(s);
}
......
......@@ -128,14 +128,12 @@ namespace Wccl {
void put_any(const std::string& s, const boost::shared_ptr<Value>& v);
/*
template<typename T> bool del(const std::string& s);
%template(del_bool) del<Bool>;
%template(del_tset) del<TSet>;
%template(del_strset) del<StrSet>;
%template(del_position) del<Position>;
%template(del_match) del<Match>;
*/
template<typename T> bool del_variable(const std::string& s);
%template(del_bool) del_variable<Bool>;
%template(del_tset) del_variable<TSet>;
%template(del_strset) del_variable<StrSet>;
%template(del_position) del_variable<Position>;
%template(del_match) del_variable<Match>;
bool del_any(const std::string& s);
......
......@@ -29,9 +29,9 @@ BOOST_AUTO_TEST_CASE(v_basic)
b = v.get<Bool>("a");
BOOST_REQUIRE(b);
BOOST_CHECK_EQUAL(b->get_value(), false);
v.del<Position>("a");
v.del_variable<Position>("a");
BOOST_CHECK(v.get<Bool>("a"));
v.del<Bool>("a");
v.del_variable<Bool>("a");
BOOST_CHECK(!v.get<Bool>("a"));
}
......@@ -40,10 +40,10 @@ BOOST_AUTO_TEST_CASE(v_del_any)
Variables v;
v.put("a", new Bool(true));
v.put("b", new Bool(true));
v.del<Bool>("a");
v.del_variable<Bool>("a");
BOOST_CHECK(!v.get<Value>("a"));
v.put("a", new Bool(true));
v.del<Value>("a");
v.del_variable<Value>("a");
BOOST_CHECK(!v.get<Value>("a"));
BOOST_CHECK(v.get<Value>("b"));
}
......@@ -136,11 +136,11 @@ BOOST_FIXTURE_TEST_CASE(set_bad, Vfix)
BOOST_CHECK_THROW(v.set("p1", Bool(true)), VariableTypeMismatch);
}
BOOST_FIXTURE_TEST_CASE(del, Vfix)
BOOST_FIXTURE_TEST_CASE(del_variable, Vfix)
{
v.del<Bool>("b1");
v.del_variable<Bool>("b1");
BOOST_CHECK(!v.get<Bool>("b1"));
v.del<Bool>("p2");
v.del_variable<Bool>("p2");
BOOST_CHECK(v.get<Value>("p2"));
v.del_any("p2");
BOOST_CHECK(!v.get<Value>("p2"));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment