Skip to content

Commit

Permalink
long double support
Browse files Browse the repository at this point in the history
  • Loading branch information
panzi committed May 23, 2014
1 parent a70c3e7 commit 2772c48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/formatstring/formatvalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace formatstring {

template<typename Char> inline void repr_value(std::basic_ostream<Char>& out, float value);
template<typename Char> inline void repr_value(std::basic_ostream<Char>& out, double value);
template<typename Char> inline void repr_value(std::basic_ostream<Char>& out, long double value);

template<typename Char> void repr_value(std::basic_ostream<Char>& out, const std::basic_string<Char>& value);
template<typename Char> void repr_value(std::basic_ostream<Char>& out, const Char* value);
Expand Down Expand Up @@ -99,6 +100,7 @@ namespace formatstring {

template<typename Char> void format_value(std::basic_ostream<Char>& out, float value, const BasicFormatSpec<Char>& spec);
template<typename Char> void format_value(std::basic_ostream<Char>& out, double value, const BasicFormatSpec<Char>& spec);
template<typename Char> void format_value(std::basic_ostream<Char>& out, long double value, const BasicFormatSpec<Char>& spec);

template<typename Char> void format_value(std::basic_ostream<Char>& out, const std::basic_string<Char>& str, const BasicFormatSpec<Char>& spec);
template<typename Char> void format_value(std::basic_ostream<Char>& out, const Char* str, const BasicFormatSpec<Char>& spec);
Expand Down Expand Up @@ -165,6 +167,7 @@ namespace formatstring {

template<typename Char> inline void format_value(std::basic_ostream<Char>& out, float value, const BasicFormatSpec<Char>& spec) { format_float(out, value, spec); }
template<typename Char> inline void format_value(std::basic_ostream<Char>& out, double value, const BasicFormatSpec<Char>& spec) { format_float(out, value, spec); }
template<typename Char> inline void format_value(std::basic_ostream<Char>& out, long double value, const BasicFormatSpec<Char>& spec) { format_float(out, value, spec); }

template<typename Char> inline void format_value(std::basic_ostream<Char>& out, const std::basic_string<Char>& str, const BasicFormatSpec<Char>& spec) { format_string(out, str.c_str(), spec); }
template<typename Char> inline void format_value(std::basic_ostream<Char>& out, const Char* str, const BasicFormatSpec<Char>& spec) { format_string(out, str, spec); }
Expand Down Expand Up @@ -198,6 +201,7 @@ namespace formatstring {

template<typename Char> inline void repr_value(std::basic_ostream<Char>& out, float value) { out << value; }
template<typename Char> inline void repr_value(std::basic_ostream<Char>& out, double value) { out << value; }
template<typename Char> inline void repr_value(std::basic_ostream<Char>& out, long double value) { out << value; }

template<typename Char> void repr_value(std::basic_ostream<Char>& out, const std::basic_string<Char>& value) { repr_string(out, value.c_str()); }
template<typename Char> void repr_value(std::basic_ostream<Char>& out, const Char* value) { repr_string(out, value); }
Expand Down Expand Up @@ -376,6 +380,9 @@ namespace formatstring {
extern template FORMATSTRING_EXPORT void format_float<char,double>(std::ostream& out, double value, const FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_float<wchar_t,double>(std::wostream& out, double value, const WFormatSpec& spec);

extern template FORMATSTRING_EXPORT void format_float<char,long double>(std::ostream& out, long double value, const FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_float<wchar_t,long double>(std::wostream& out, long double value, const WFormatSpec& spec);

extern template FORMATSTRING_EXPORT void format_integer<char,char>(std::ostream& out, char value, const FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_integer<char,short>(std::ostream& out, short value, const FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_integer<char,int>(std::ostream& out, int value, const FormatSpec& spec);
Expand Down Expand Up @@ -414,6 +421,7 @@ namespace formatstring {

extern template FORMATSTRING_EXPORT void format_float<char16_t,float>(std::basic_ostream<char16_t>& out, float value, const U16FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_float<char16_t,double>(std::basic_ostream<char16_t>& out, double value, const U16FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_float<char16_t,long double>(std::basic_ostream<char16_t>& out, long double value, const U16FormatSpec& spec);

extern template FORMATSTRING_EXPORT void format_integer<char16_t,char16_t>(std::basic_ostream<char16_t>& out, char16_t value, const U16FormatSpec& spec);

Expand Down Expand Up @@ -442,6 +450,7 @@ namespace formatstring {

extern template FORMATSTRING_EXPORT void format_float<char32_t,float>(std::basic_ostream<char32_t>& out, float value, const U32FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_float<char32_t,double>(std::basic_ostream<char32_t>& out, double value, const U32FormatSpec& spec);
extern template FORMATSTRING_EXPORT void format_float<char32_t,long double>(std::basic_ostream<char32_t>& out, long double value, const U32FormatSpec& spec);

extern template FORMATSTRING_EXPORT void format_integer<char32_t,char32_t>(std::basic_ostream<char32_t>& out, char32_t value, const U32FormatSpec& spec);

Expand Down
5 changes: 5 additions & 0 deletions src/formatvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@ template void format_float<wchar_t,float>(std::wostream& out, float value, const
template void format_float<char,double>(std::ostream& out, double value, const FormatSpec& spec);
template void format_float<wchar_t,double>(std::wostream& out, double value, const WFormatSpec& spec);

template void format_float<char,long double>(std::ostream& out, long double value, const FormatSpec& spec);
template void format_float<wchar_t,long double>(std::wostream& out, long double value, const WFormatSpec& spec);

template void format_integer<char,char>(std::ostream& out, char value, const FormatSpec& spec);
template void format_integer<char,short>(std::ostream& out, short value, const FormatSpec& spec);
template void format_integer<char,int>(std::ostream& out, int value, const FormatSpec& spec);
Expand Down Expand Up @@ -604,6 +607,7 @@ template void format_string<char16_t>(std::basic_ostream<char16_t>& out, const c

template void format_float<char16_t,float>(std::basic_ostream<char16_t>& out, float value, const U16FormatSpec& spec);
template void format_float<char16_t,double>(std::basic_ostream<char16_t>& out, double value, const U16FormatSpec& spec);
template void format_float<char16_t,long double>(std::basic_ostream<char16_t>& out, long double value, const U16FormatSpec& spec);

template void format_integer<char16_t,char16_t>(std::basic_ostream<char16_t>& out, char16_t value, const U16FormatSpec& spec);

Expand Down Expand Up @@ -635,6 +639,7 @@ template void format_string<char32_t>(std::basic_ostream<char32_t>& out, const c

template void format_float<char32_t,float>(std::basic_ostream<char32_t>& out, float value, const U32FormatSpec& spec);
template void format_float<char32_t,double>(std::basic_ostream<char32_t>& out, double value, const U32FormatSpec& spec);
template void format_float<char32_t,long double>(std::basic_ostream<char32_t>& out, long double value, const U32FormatSpec& spec);

template void format_integer<char32_t,char32_t>(std::basic_ostream<char32_t>& out, char32_t value, const U32FormatSpec& spec);

Expand Down

0 comments on commit 2772c48

Please sign in to comment.