////
- template <typename T>
+ template <typename T = int>
struct num_string_
{
private:
- template <typename _Strm, typename _Document, typename U>
- bool generate_impl(_Strm& strm, _Document& doc) const
+ template <typename _Strm, typename _Document>
+ bool _generate_signed(_Strm& strm, _Document& doc) const
{
+ char work[12];
+ sprintf(work, "%d", value);
+ strm << work;
return true;
}
- template <typename _Strm, typename _Document, typename U>
- bool generate_impl(_Strm& strm, _Document& doc) const
+ template <typename _Strm, typename _Document>
+ bool _generate_unsigned(_Strm& strm, _Document& doc) const
{
+ char work[11];
+ sprintf(work, "%d", value);
+ strm << work;
return true;
}
template <typename _Strm, typename _Document>
bool generate(_Strm& strm, _Document& doc) const
{
- strm << m_str;
- return true;
+ if ( type_traits::is_signed<T>::value )
+ return _generate_signed(strm, doc);
+ else
+ return _generate_unsigned(strm, doc);
}
operator const T(){ return value; }
};
+ typedef num_string_<> num_string;
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
template <int _Integral, int _Decimal, int _DecimalZeroCount=0>
- class float_string : public seq<
- num_string<_Integral>,
+ class fixed_float_string : public seq<
+ fixed_num_string<_Integral>,
chars::dot,
fixed_repeat<unichar<'0'>, _DecimalZeroCount>,
- num_string<_Decimal>
+ fixed_num_string<_Decimal>
> {};
///////////////////////////////////////////////////////////////////
}
+ using namespace rule;
}
}