31#ifndef ETL_BASIC_FORMAT_SPEC_INCLUDED
32#define ETL_BASIC_FORMAT_SPEC_INCLUDED
38#include "static_assert.h"
42 namespace private_basic_format_spec
49 ETL_CONSTEXPR
base_spec(uint_least8_t base_)
54 const uint_least8_t base;
65 const uint_least8_t width;
69 template <
typename TChar>
84 : precision(precision_)
88 const uint_least8_t precision;
95 : upper_case(upper_case_)
99 const bool upper_case;
106 : boolalpha(boolalpha_)
110 const bool boolalpha;
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>
151 static ETL_CONSTEXPR private_basic_format_spec::fill_spec<TChar> setfill(TChar fill)
153 return private_basic_format_spec::fill_spec<TChar>(fill);
157 static ETL_CONSTEXPR private_basic_format_spec::precision_spec setprecision(uint32_t precision)
159 return private_basic_format_spec::precision_spec(precision);
163 static ETL_CONSTANT private_basic_format_spec::base_spec bin(2U);
166 static ETL_CONSTANT private_basic_format_spec::base_spec oct(8U);
169 static ETL_CONSTANT private_basic_format_spec::base_spec dec(10U);
172 static ETL_CONSTANT private_basic_format_spec::base_spec hex(16U);
175 static ETL_CONSTANT private_basic_format_spec::left_spec left;
178 static ETL_CONSTANT private_basic_format_spec::right_spec right;
181 static ETL_CONSTANT private_basic_format_spec::boolalpha_spec boolalpha(
true);
184 static ETL_CONSTANT private_basic_format_spec::boolalpha_spec noboolalpha(
false);
187 static ETL_CONSTANT private_basic_format_spec::uppercase_spec uppercase(
true);
190 static ETL_CONSTANT private_basic_format_spec::uppercase_spec nouppercase(
false);
193 static ETL_CONSTANT private_basic_format_spec::showbase_spec showbase(
true);
196 static ETL_CONSTANT private_basic_format_spec::showbase_spec noshowbase(
false);
201 template <
typename TString>
214 , left_justified_(false)
217 , fill_(typename TString::value_type(
' '))
225 uint_least8_t width__,
226 uint_least8_t precision__,
228 bool left_justified__,
231 typename TString::value_type fill__)
234 , precision_(precision__)
235 , upper_case_(upper_case__)
236 , left_justified_(left_justified__)
237 , boolalpha_(boolalpha__)
238 , show_base_(show_base__)
252 left_justified_ =
false;
255 fill_ =
typename TString::value_type(
' ');
264 base_ =
static_cast<uint_least8_t
>(b);
340 width_ =
static_cast<uint_least8_t
>(w);
358 precision_ =
static_cast<uint_least8_t
>(p);
401 ETL_CONSTEXPR
typename TString::value_type
get_fill()
const
412 left_justified_ =
true;
421 return left_justified_;
430 left_justified_ =
false;
439 return !left_justified_;
465 return (lhs.base_ == rhs.base_) &&
466 (lhs.width_ == rhs.width_) &&
467 (lhs.precision_ == rhs.precision_) &&
468 (lhs.upper_case_ == rhs.upper_case_) &&
469 (lhs.left_justified_ == rhs.left_justified_) &&
470 (lhs.boolalpha_ == rhs.boolalpha_) &&
471 (lhs.show_base_ == rhs.show_base_) &&
472 (lhs.fill_ == rhs.fill_);
480 return !(lhs == rhs);
486 uint_least8_t width_;
487 uint_least8_t precision_;
489 bool left_justified_;
492 typename TString::value_type fill_;
bitset_ext
Definition: absolute.h:38