Removed usage of two separate numeric types for attribute values.

(Fix for bug #16950.)
This commit is contained in:
Guillaume Melquiond 2010-10-25 19:48:27 +00:00
parent 00a1fad67e
commit 181494eb43
4 changed files with 2 additions and 10 deletions

View file

@ -63,7 +63,7 @@ config::attribute_value &config::attribute_value::operator=(bool v)
config::attribute_value &config::attribute_value::operator=(int v)
{
value = v;
value = double(v);
return *this;
}
@ -103,7 +103,6 @@ bool config::attribute_value::to_bool(bool def) const
int config::attribute_value::to_int(int def) const
{
if (const int *p = boost::get<const int>(&value)) return *p;
if (const double *p = boost::get<const double>(&value)) return int(*p);
return def;
}
@ -111,7 +110,6 @@ int config::attribute_value::to_int(int def) const
double config::attribute_value::to_double(double def) const
{
if (const double *p = boost::get<const double>(&value)) return *p;
if (const int *p = boost::get<const int>(&value)) return *p;
return def;
}
@ -124,8 +122,6 @@ struct config_attribute_str_visitor : boost::static_visitor<std::string>
static std::string s_yes("yes"), s_no("no");
return b ? s_yes : s_no;
}
std::string operator()(int i) const
{ return str_cast(i); }
std::string operator()(double d) const
{ return str_cast(d); }
std::string operator()(std::string const &s) const

View file

@ -160,7 +160,7 @@ public:
*/
class attribute_value
{
typedef boost::variant<boost::blank, bool, int, double, std::string, t_string> value_type;
typedef boost::variant<boost::blank, bool, double, std::string, t_string> value_type;
value_type value;
public:

View file

@ -154,8 +154,6 @@ struct luaW_pushscalar_visitor : boost::static_visitor<>
{ lua_pushnil(L); }
void operator()(bool b) const
{ lua_pushboolean(L, b); }
void operator()(int i) const
{ lua_pushinteger(L, i); }
void operator()(double d) const
{ lua_pushnumber(L, d); }
void operator()(std::string const &s) const

View file

@ -394,8 +394,6 @@ struct write_key_val_visitor : boost::static_visitor<void>
{ out_ << "\"\""; }
void operator()(bool b) const
{ out_ << (b ? "yes" : "no"); }
void operator()(int i) const
{ out_ << i; }
void operator()(double d) const
{ out_ << d; }
void operator()(std::string const &s) const