BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdldfp::Decimal_FormatterSpecification< t_CHAR > Struct Template Reference

#include <bdldfp_decimal.h>

Detailed Description

template<class t_CHAR>
struct bdldfp::Decimal_FormatterSpecification< t_CHAR >

This template is the implementation of the bsl::format specification for bdldfp::Decimal* types. It parses as well as postprocesses format specifications for bdldfp::Decimal* type formatted arguments, as well as stores the results of that pasring: the specification.

See bdldfp_decimal

Public Types

enum  FormatType {
  e_TYPE_UNASSIGNED , e_FORMAT_DEFAULT , e_FORMAT_SCIENTIFIC , e_FORMAT_SCIENTIFIC_UC ,
  e_FORMAT_FIXED , e_FORMAT_FIXED_UC , e_FORMAT_GENERAL , e_FORMAT_GENERAL_UC
}
 

Public Member Functions

BSLS_KEYWORD_CONSTEXPR_CPP20 Decimal_FormatterSpecification ()
 
template<class t_PARSE_CONTEXT >
BSLS_KEYWORD_CONSTEXPR_CPP20 void parse (t_PARSE_CONTEXT *context)
 
template<typename t_FORMAT_CONTEXT >
void postprocess (const t_FORMAT_CONTEXT &context)
 
BSLS_KEYWORD_CONSTEXPR_CPP20 const t_CHAR * filler () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 int fillerCharacters () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 int fillerCodePointDisplayWidth () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 Parser::Alignment alignment () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 Parser::Sign sign () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 bool alternativeFlag () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 bool zeroPaddingFlag () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 const bslfmt::FormatterSpecificationNumericValue postprocessedWidth () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 const bslfmt::FormatterSpecificationNumericValue postprocessedPrecision () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 bool localeSpecificFlag () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 FormatType formatType () const
 

Member Enumeration Documentation

◆ FormatType

This enumeration is used as an indication of the format-type letter in a decimal floating point format string.

Enumerator
e_TYPE_UNASSIGNED 
e_FORMAT_DEFAULT 

Default value.

e_FORMAT_SCIENTIFIC 

none

e_FORMAT_SCIENTIFIC_UC 

e

e_FORMAT_FIXED 

E

e_FORMAT_FIXED_UC 

f

e_FORMAT_GENERAL 

F

e_FORMAT_GENERAL_UC 

g

Constructor & Destructor Documentation

◆ Decimal_FormatterSpecification()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 bdldfp::Decimal_FormatterSpecification< t_CHAR >::Decimal_FormatterSpecification ( )

Create an uninitialized Decimal_FormatterSpecification object.

Member Function Documentation

◆ alignment()

Return the enumerator representing the requested alignment unless the status is not at least e_STATE_PARSED in which case throw a bsl::format_error exception indicating that error.

◆ alternativeFlag()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 bool bdldfp::Decimal_FormatterSpecification< t_CHAR >::alternativeFlag ( ) const

Return a boolean indicating if alternative formatting was requested unless the status is not at least e_STATE_PARSED in which case throw a bsl::format_error exception indicating that error.

◆ filler()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 const t_CHAR * bdldfp::Decimal_FormatterSpecification< t_CHAR >::filler ( ) const

Return a pointer to the character array that stored the parsed filler character that may be a multibyte code point or just a single character unless the status is not e_STATE_POSTPROCESSED in which case throw a bsl::format_error exception indicating that error. See also numFillerCharacters() that provides the number of characters in the array returned by this function (at least one).

◆ fillerCharacters()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 int bdldfp::Decimal_FormatterSpecification< t_CHAR >::fillerCharacters ( ) const

Return the number of filler characters in the array returned by filler()unless the status is not e_STATE_POSTPROCESSED in which case throw a bsl::format_error exception indicating that error.

◆ fillerCodePointDisplayWidth()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 int bdldfp::Decimal_FormatterSpecification< t_CHAR >::fillerCodePointDisplayWidth ( ) const

Return the display width of the code point represented by the array returned by filler().

◆ formatType()

Return the format-type requested unless the status is not at least e_STATE_PARSED in which case throw a bsl::format_error exception indicating that error.

◆ localeSpecificFlag()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 bool bdldfp::Decimal_FormatterSpecification< t_CHAR >::localeSpecificFlag ( ) const

Return a boolean indicating if the locale specific flag was present in the format specification unless the status is not at least e_STATE_PARSED in which case throw a bsl::format_error exception indicating that error.

Note
Note that the locale specific flag is not yet supported hence the attempt to format with a specification that has this flags set will result in an exception indicating that.

◆ parse()

template<class t_CHAR >
template<class t_PARSE_CONTEXT >
BSLS_KEYWORD_CONSTEXPR_CPP20 void bdldfp::Decimal_FormatterSpecification< t_CHAR >::parse ( t_PARSE_CONTEXT *  context)

Parse a decimal floating point format string using the iterator-range from the specified context and if successful load the results into this object as well as set its status to e_PARSED; otherwise, if the format specification denoted by the context iterator-range is not a valid decimal floating point format specification throw a bsl::format_error exception.

◆ postprocess()

template<class t_CHAR >
template<typename t_FORMAT_CONTEXT >
void bdldfp::Decimal_FormatterSpecification< t_CHAR >::postprocess ( const t_FORMAT_CONTEXT &  context)

Postprocess this object using the argument values provided by the specified context to fill in the values of nested width or precision parameters if such deferred parameters exist and set the status to e_STATE_POSTPROCESSED. By nested format parameters we mean parameters whose value comes from an argument to the formatter function, and not an literal integer value within the format string. In case of an error throw a bsl::format_error exception.

◆ postprocessedPrecision()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 const bslfmt::FormatterSpecificationNumericValue bdldfp::Decimal_FormatterSpecification< t_CHAR >::postprocessedPrecision ( ) const

Return an optional value representing the requested precision unless the status is not e_STATE_POSTPROCESSED in which case throw a bsl::format_error exception indicating that error.

Note
Note that the returned type is capable of representing more than just an optional integer, but after preprocessing it will have only two possible states: no value, or an integer value.

◆ postprocessedWidth()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 const bslfmt::FormatterSpecificationNumericValue bdldfp::Decimal_FormatterSpecification< t_CHAR >::postprocessedWidth ( ) const

Return an optional value representing the requested width unless the status is not e_STATE_POSTPROCESSED in which case throw a bsl::format_error exception indicating that error.

Note
Note that the returned type is capable of representing more than just an optional integer, but after preprocessing it will have only two possible states: no value, or an integer value.

◆ sign()

Return the enumerator representing the requested sign-treatment option unless the status is not at least e_STATE_PARSED in which case throw a bsl::format_error exception indicating that error.

◆ zeroPaddingFlag()

template<class t_CHAR >
BSLS_KEYWORD_CONSTEXPR_CPP20 bool bdldfp::Decimal_FormatterSpecification< t_CHAR >::zeroPaddingFlag ( ) const

Return a boolean indicating if zero padding was requested unless the status is not at least e_STATE_PARSED in which case throw a bsl::format_error exception indicating that error.


The documentation for this struct was generated from the following file: