17 #include <boost/spirit/include/qi.hpp>
18 #include <boost/spirit/include/karma.hpp>
19 #include <boost/type_traits.hpp>
29 namespace StringConversions
64 return writtenDigits<T>();
70 if (boost::spirit::traits::test_zero(n))
71 return base_policy_type::fmtflags::fixed;
73 T abs_n = boost::spirit::traits::get_absolute_value(n);
76 return (abs_n >= 1e4 || abs_n < 1e-2)
77 ? base_policy_type::fmtflags::scientific : base_policy_type::fmtflags::fixed;
94 std::back_insert_iterator<std::string> sink(target);
95 boost::spirit::karma::generate(sink, i);
115 std::back_insert_iterator<std::string> sink(target);
116 boost::spirit::karma::generate(sink, f);
131 std::back_insert_iterator<std::string> sink(target);
132 boost::spirit::karma::generate(sink, d);
146 std::back_insert_iterator<std::string> sink(target);
147 boost::spirit::karma::generate(sink, ld);
162 std::back_insert_iterator<std::string> sink(target);
178 std::back_insert_iterator<std::string> sink(target);
193 std::back_insert_iterator<std::string> sink(target);
207 target += d.
toString(full_precision);
218 return std::string(1,
c);
228 return std::string(s);
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:33
String toString(bool full_precision=true) const
Conversion to String full_precision Controls number of fractional digits for all double types or list...
Definition: StringConversions.h:35
static unsigned precision(T)
Definition: StringConversions.h:38
static unsigned floatfield(T n)
Definition: StringConversions.h:68
boost::spirit::karma::real_policies< T > base_policy_type
Definition: StringConversions.h:36
A more convenient string class.
Definition: String.h:34
const double c
Definition: Constants.h:188
boost::spirit::karma::real_generator< long double, BK_PrecPolicy< long double > > BK_PrecPolicyLongDouble_type
Definition: StringConversions.h:84
boost::spirit::karma::real_generator< float, BK_PrecPolicy< float > > BK_PrecPolicyFloat_type
Definition: StringConversions.h:80
const BK_PrecPolicyLongDouble_type BK_PrecPolicyLongDouble
Definition: StringConversions.h:85
String toStringLowP(float f)
low precision (3 fractional digits) conversion to string (Karma default)
Definition: StringConversions.h:119
void appendLowP(float f, String &target)
Definition: StringConversions.h:113
const BK_PrecPolicyDouble_type BK_PrecPolicyDouble
Definition: StringConversions.h:83
String toString(const T &i)
fallback template for general purpose using Boost::Karma; more specializations below
Definition: StringConversions.h:100
void append(const T &i, String &target)
Definition: StringConversions.h:92
const BK_PrecPolicyFloat_type BK_PrecPolicyFloat
Definition: StringConversions.h:81
boost::spirit::karma::real_generator< double, BK_PrecPolicy< double > > BK_PrecPolicyDouble_type
Definition: StringConversions.h:82
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22