31#ifndef ETL_TO_STRING_HELPER_INCLUDED
32#define ETL_TO_STRING_HELPER_INCLUDED
36#include "../platform.h"
37#include "../absolute.h"
38#include "../negative.h"
39#include "../basic_format_spec.h"
40#include "../type_traits.h"
41#include "../container.h"
42#include "../absolute.h"
43#include "../algorithm.h"
44#include "../iterator.h"
50#if ETL_USING_STL && ETL_USING_CPP11
56 namespace private_to_string
58#if ETL_NOT_USING_64BIT_TYPES
69 template <
typename TIString>
94 template <
typename TIString>
100 typedef typename TIString::value_type type;
101 typedef typename TIString::iterator
iterator;
103 static const type t[] = {
't',
'r',
'u',
'e' };
104 static const type
f[] = {
'f',
'a',
'l',
's',
'e' };
117 str.insert(str.end(), ETL_OR_STD11::begin(t), ETL_OR_STD11::end(t));
121 str.insert(str.end(), ETL_OR_STD11::begin(
f), ETL_OR_STD11::end(
f));
128 str.push_back(type(
'1'));
132 str.push_back(type(
'0'));
142 template <
typename T,
typename TIString>
149 typedef typename TIString::value_type type;
150 typedef typename TIString::iterator
iterator;
164 str.push_back(type(
'-'));
167 str.push_back(type(
'0'));
182 str.push_back(type(
'-'));
191 str.push_back(format.
is_upper_case() ? type(
'B') : type(
'b'));
192 str.push_back(type(
'0'));
198 str.push_back(type(
'0'));
204 str.push_back(format.
is_upper_case() ? type(
'X') : type(
'x'));
205 str.push_back(type(
'0'));
217 etl::reverse(start, str.end());
226 template <
typename TIString>
231 typedef typename TIString::value_type type;
233 static const type
n[] = {
'n',
'a',
'n' };
234 static const type i[] = {
'i',
'n',
'f' };
238 str.insert(str.end(), ETL_OR_STD11::begin(
n), ETL_OR_STD11::end(
n));
242 str.insert(str.end(), ETL_OR_STD11::begin(i), ETL_OR_STD11::end(i));
249 template <
typename TIString>
257 typedef typename TIString::value_type type;
263 str.push_back(type(
'.'));
268#if ETL_USING_64BIT_TYPES
272 template <
typename TIString>
280 typedef typename TIString::value_type type;
286 str.push_back(type(
'.'));
295 template <
typename T,
typename TIString>
301 typedef typename TIString::iterator
iterator;
302 typedef typename TIString::value_type type;
320#if ETL_NOT_USING_64BIT_TYPES
333 uworkspace_t multiplier = 1U;
363 template <
typename T,
typename TIString>
368 const bool append =
false)
370 typedef typename TIString::iterator
iterator;
371 typedef typename TIString::value_type type;
442 template <
typename TIString>
456 template <
typename TIString>
467 typename TIString::iterator start = str.end();
469 str.insert(str.end(), value.begin(), value.end());
477 template <
typename TSringView,
typename TIString>
488 typename TIString::iterator start = str.end();
490 str.insert(str.end(), value.begin(), value.end());
500 template <
typename TIString>
504 const bool append =
false)
514 template <
typename TIString>
518 const bool append =
false)
525#if ETL_USING_64BIT_TYPES
529 template <
typename T,
typename TIString>
532 !etl::is_one_of<T, int64_t, uint64_t>::value,
const TIString&>::type
545 template <
typename T,
typename TIString>
548 etl::is_one_of<T, int64_t, uint64_t>::value,
const TIString&>::type
559 template <
typename T,
typename TIString>
562 !etl::is_one_of<T, int64_t, uint64_t>::value,
const TIString&>::type
575 template <
typename T,
typename TIString>
578 etl::is_one_of<T, int64_t, uint64_t>::value,
const TIString&>::type
589 template <
typename T,
typename TIString>
596 etl::private_to_string::add_integral(type(value), str, format, append,
false);
604 template <
typename T,
typename TIString>
609 etl::private_to_string::add_integral_denominated(type(value),
denominator_exponent, str, format, append,
false);
618 template <
typename T,
typename TIString>
add_pointer
Definition type_traits_generator.h:937
conditional
Definition type_traits_generator.h:1199
enable_if
Definition type_traits_generator.h:1230
is_same
Definition type_traits_generator.h:1080
make_unsigned
Definition type_traits_generator.h:1220
bitset_ext
Definition absolute.h:38
ETL_CONSTEXPR14 etl::enable_if< etl::is_specialization< TToDuration, etl::chrono::duration >::value, TToDuration >::type floor(const etl::chrono::duration< TRep, TPeriod > &d) ETL_NOEXCEPT
Rounds down a duration to the nearest lower precision.
Definition duration.h:643
ETL_CONSTEXPR14 etl::enable_if< etl::is_specialization< TToDuration, etl::chrono::duration >::value, TToDuration >::type round(const etl::chrono::duration< TRep, TPeriod > &d) ETL_NOEXCEPT
Definition duration.h:680
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition scaled_rounding.h:314
iterator
Definition iterator.h:399
void add_alignment(TIString &str, typename TIString::iterator position, const etl::basic_format_spec< TIString > &format)
Helper function for left/right alignment.
Definition to_string_helper.h:70
void add_floating_point(const T value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for floating point.
Definition to_string_helper.h:296
void add_string(const TIString &value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for strings.
Definition to_string_helper.h:457
void add_integral_denominated(const T value, const uint32_t denominator_exponent, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append=false)
Helper function for denominated integers.
Definition to_string_helper.h:364
void add_nan_inf(const bool not_a_number, const bool infinity, TIString &str)
Helper function for floating point nan and inf.
Definition to_string_helper.h:227
void add_integral_and_fractional(const uint32_t integral, const uint32_t fractional, TIString &str, const etl::basic_format_spec< TIString > &integral_format, const etl::basic_format_spec< TIString > &fractional_format, const bool negative)
Helper function for floating point integral and fractional.
Definition to_string_helper.h:250
const TIString & to_string(const bool value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append=false)
For booleans.
Definition to_string_helper.h:501
void add_integral(T value, TIString &str, const etl::basic_format_spec< TIString > &format, bool append, const bool negative)
Helper function for integrals.
Definition to_string_helper.h:143
void add_string_view(const TSringView &value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for string views.
Definition to_string_helper.h:478
void add_pointer(const volatile void *value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for pointers.
Definition to_string_helper.h:443
void add_boolean(const bool value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append)
Helper function for booleans.
Definition to_string_helper.h:95