code cleanup

This commit is contained in:
Artem Pavlenko 2006-03-22 20:31:02 +00:00
parent 1ae34ab1d5
commit 6f1ed0029c

View file

@ -327,20 +327,20 @@ namespace mapnik {
} }
}; };
struct to_expression_string : public boost::static_visitor<std::string> struct to_expression_string : public boost::static_visitor<std::string>
{ {
template <typename T> template <typename T>
std::string operator() (T val) const std::string operator() (T val) const
{ {
std::stringstream ss; std::stringstream ss;
ss << val; ss << val;
return ss.str(); return ss.str();
} }
std::string operator() (std::string const& val) const std::string operator() (std::string const& val) const
{ {
return "'" + val + "'"; return "'" + val + "'";
} }
}; };
} }
class value class value
@ -350,9 +350,7 @@ namespace mapnik {
friend const value operator-(value const&,value const&); friend const value operator-(value const&,value const&);
friend const value operator*(value const&,value const&); friend const value operator*(value const&,value const&);
friend const value operator/(value const&,value const&); friend const value operator/(value const&,value const&);
//friend template <typename charT, typename traits>
// std::basic_ostream<charT,traits>& operator << (std::basic_ostream<charT,traits>&,
// value const& );
public: public:
value () value ()
: base_(0) {} : base_(0) {}
@ -360,16 +358,6 @@ namespace mapnik {
template <typename T> value(T _val_) template <typename T> value(T _val_)
: base_(_val_) {} : base_(_val_) {}
//value (std::string const& str)
// : base(str) {}
//value& operator=(value const& rhs)
//{
// if (this == &rhs)
// return *this;
// //TODO!!!!!
// return *this;
//}
bool operator==(value const& other) const bool operator==(value const& other) const
{ {
return boost::apply_visitor(impl::equals(),base_,other.base_); return boost::apply_visitor(impl::equals(),base_,other.base_);
@ -399,35 +387,11 @@ namespace mapnik {
{ {
return boost::apply_visitor(impl::less_or_equal(),base_,other.base_); return boost::apply_visitor(impl::less_or_equal(),base_,other.base_);
} }
value_base const& base() const value_base const& base() const
{
return base_;
}
/*
value& operator+=(value const& other)
{ {
*this = boost::apply_visitor(impl::add<value>(),*this,other); return base_;
return *this;
} }
value& operator-=(value const& other)
{
*this = boost::apply_visitor(impl::sub<value>(),*this,other);
return *this;
}
value& operator*=(value const& other)
{
*this = boost::apply_visitor(impl::mult<value>(),*this,other);
return *this;
}
value& operator/=(value const& other)
{
*this = boost::apply_visitor(impl::div<value>(),*this,other);
return *this;
}
*/
std::string to_expression_string() const std::string to_expression_string() const
{ {
return boost::apply_visitor(impl::to_expression_string(),base_); return boost::apply_visitor(impl::to_expression_string(),base_);
@ -441,35 +405,27 @@ namespace mapnik {
inline const value operator+(value const& p1,value const& p2) inline const value operator+(value const& p1,value const& p2)
{ {
//value tmp(p1);
//tmp+=p2; return value(boost::apply_visitor(impl::add<value>(),p1.base_, p2.base_));
//return tmp;
return value(boost::apply_visitor(impl::add<value>(),p1.base_, p2.base_));
} }
inline const value operator-(value const& p1,value const& p2) inline const value operator-(value const& p1,value const& p2)
{ {
//value tmp(p1);
//tmp-=p2; return value(boost::apply_visitor(impl::sub<value>(),p1.base_, p2.base_));
//return tmp;
return value(boost::apply_visitor(impl::sub<value>(),p1.base_, p2.base_));
} }
inline const value operator*(value const& p1,value const& p2) inline const value operator*(value const& p1,value const& p2)
{ {
//value tmp(p1);
//tmp*=p2; return value(boost::apply_visitor(impl::mult<value>(),p1.base_, p2.base_));
//return tmp;
return value(boost::apply_visitor(impl::mult<value>(),p1.base_, p2.base_));
} }
inline const value operator/(value const& p1,value const& p2) inline const value operator/(value const& p1,value const& p2)
{ {
//value tmp(p1);
//tmp/=p2; return value(boost::apply_visitor(impl::div<value>(),p1.base_, p2.base_));
//return tmp; }
return value(boost::apply_visitor(impl::div<value>(),p1.base_, p2.base_));
}
template <typename charT, typename traits> template <typename charT, typename traits>
inline std::basic_ostream<charT,traits>& inline std::basic_ostream<charT,traits>&