31#ifndef ETL_BASIC_FORMAT_SPEC_INCLUDED
32#define ETL_BASIC_FORMAT_SPEC_INCLUDED
42 namespace private_basic_format_spec
49 ETL_CONSTEXPR base_spec(uint_least8_t base_)
54 const uint_least8_t base;
60 ETL_CONSTEXPR width_spec(uint_least8_t width_)
65 const uint_least8_t width;
69 template <
typename TChar>
72 ETL_CONSTEXPR fill_spec(TChar fill_)
83 ETL_CONSTEXPR precision_spec(uint_least8_t precision_)
84 : precision(precision_)
88 const uint_least8_t precision;
94 ETL_CONSTEXPR uppercase_spec(
bool upper_case_)
95 : upper_case(upper_case_)
99 const bool upper_case;
103 struct boolalpha_spec
105 ETL_CONSTEXPR boolalpha_spec(
bool boolalpha_)
106 : boolalpha(boolalpha_)
110 const bool boolalpha;
116 ETL_CONSTEXPR showbase_spec(
bool show_base_)
117 : show_base(show_base_)
121 const bool show_base;
144 static ETL_CONSTEXPR private_basic_format_spec::width_spec setw(uint32_t width)
146 return private_basic_format_spec::width_spec(width);
150 template <
typename TChar>
201 template <
typename TString>
214 , left_justified_(false)
225 ETL_CONSTEXPR
basic_format_spec(uint_least8_t base__, uint_least8_t width__, uint_least8_t precision__,
bool upper_case__,
bool left_justified__,
226 bool boolalpha__,
bool show_base__,
typename TString::value_type fill__,
bool scientific__ =
false) ETL_NOEXCEPT
229 , precision_(precision__)
230 , upper_case_(upper_case__)
231 , left_justified_(left_justified__)
232 , boolalpha_(boolalpha__)
233 , show_base_(show_base__)
235 , scientific_(scientific__)
242 ETL_CONSTEXPR14
void clear() ETL_NOEXCEPT
248 left_justified_ =
false;
252 fill_ =
typename TString::value_type(
' ');
261 base_ =
static_cast<uint_least8_t
>(b);
269 base_ =
static_cast<uint_least8_t
>(b);
270 return etl::move(*
this);
287 return etl::move(
base(2));
304 return etl::move(
base(8));
321 return etl::move(
base(10));
338 return etl::move(
base(16));
345 ETL_CONSTEXPR uint32_t
get_base() const ETL_NOEXCEPT
365 return etl::move(*
this);
383 width_ =
static_cast<uint_least8_t
>(w);
391 width_ =
static_cast<uint_least8_t
>(w);
392 return etl::move(*
this);
410 precision_ =
static_cast<uint_least8_t
>(p);
418 precision_ =
static_cast<uint_least8_t
>(p);
419 return etl::move(*
this);
446 return etl::move(*
this);
470 ETL_CONSTEXPR14
basic_format_spec&&
fill(
typename TString::value_type c) ETL_RVALUE_REF_QUALIFIER ETL_NOEXCEPT
473 return etl::move(*
this);
480 ETL_CONSTEXPR
typename TString::value_type
get_fill() const ETL_NOEXCEPT
491 left_justified_ =
true;
499 left_justified_ =
true;
500 return etl::move(*
this);
507 ETL_CONSTEXPR
bool is_left() const ETL_NOEXCEPT
509 return left_justified_;
518 left_justified_ =
false;
526 left_justified_ =
false;
527 return etl::move(*
this);
536 return !left_justified_;
554 return etl::move(*
this);
581 return etl::move(*
this);
598 return (lhs.base_ == rhs.base_) && (lhs.width_ == rhs.width_) && (lhs.precision_ == rhs.precision_) && (lhs.upper_case_ == rhs.upper_case_)
599 && (lhs.left_justified_ == rhs.left_justified_) && (lhs.boolalpha_ == rhs.boolalpha_) && (lhs.show_base_ == rhs.show_base_)
600 && (lhs.fill_ == rhs.fill_) && (lhs.scientific_ == rhs.scientific_);
608 return !(lhs == rhs);
614 uint_least8_t width_;
615 uint_least8_t precision_;
617 bool left_justified_;
620 typename TString::value_type fill_;