BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt::FormatterSpecificationNumericValue Struct Reference

#include <bslfmt_formatterspecificationnumericvalue.h>

Detailed Description

Type holding a category plus an optional integral value. This is a value semantic type primarily used to represent width and precision of a format specification.

See bslfmt_formatterspecificationnumericvalue

Public Types

enum  Category { e_DEFAULT , e_VALUE , e_NEXT_ARG , e_ARG_ID }
 

Public Member Functions

BSLS_KEYWORD_CONSTEXPR_CPP20 FormatterSpecificationNumericValue ()
 
BSLS_KEYWORD_CONSTEXPR_CPP20 FormatterSpecificationNumericValue (Category category, int value)
 
template<class t_ITER >
void BSLS_KEYWORD_CONSTEXPR_CPP20 parse (t_ITER *start, t_ITER end, bool needInitialDot)
 
template<typename t_FORMAT_CONTEXT >
void postprocess (const t_FORMAT_CONTEXT &context)
 
BSLS_KEYWORD_CONSTEXPR_CPP20 bool operator== (const FormatterSpecificationNumericValue &other) const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 Category category () const
 
BSLS_KEYWORD_CONSTEXPR_CPP20 int value () const
 
template<class t_ITER >
BSLS_KEYWORD_CONSTEXPR_CPP20 void parse (t_ITER *start, t_ITER end, bool needInitialDot)
 

Friends

class FormatterSpecificationNumericValue_ArgVisitor
 

Member Enumeration Documentation

◆ Category

Enumerator
e_DEFAULT 
e_VALUE 
e_NEXT_ARG 
e_ARG_ID 

Constructor & Destructor Documentation

◆ FormatterSpecificationNumericValue() [1/2]

BSLS_KEYWORD_CONSTEXPR_CPP20 bslfmt::FormatterSpecificationNumericValue::FormatterSpecificationNumericValue ( )
inline

Create a FormatterSpecificationNumericValue object with e_DEFAULT category and 0 value.

◆ FormatterSpecificationNumericValue() [2/2]

BSLS_KEYWORD_CONSTEXPR_CPP20 bslfmt::FormatterSpecificationNumericValue::FormatterSpecificationNumericValue ( Category  category,
int  value 
)
inline

Create a FormatterSpecificationNumericValue object with the specified value and category attributes.

Member Function Documentation

◆ category()

BSLS_KEYWORD_CONSTEXPR_CPP20 FormatterSpecificationNumericValue::Category bslfmt::FormatterSpecificationNumericValue::category ( ) const
inline

Return the category attribute of this object.

◆ operator==()

BSLS_KEYWORD_CONSTEXPR_CPP20 bool bslfmt::FormatterSpecificationNumericValue::operator== ( const FormatterSpecificationNumericValue other) const
inline

Return true if this object is equal to the specified other object, otherwise return false. Two FormatterSpecificationNumericValue objects are considered equal if their category and value attributes are both equal.

◆ parse() [1/2]

template<class t_ITER >
void BSLS_KEYWORD_CONSTEXPR_CPP20 bslfmt::FormatterSpecificationNumericValue::parse ( t_ITER *  start,
t_ITER  end,
bool  needInitialDot 
)

Parse the string in the random-access-iterator range specified by start and end to extract either a hard-coded integer or a nested argument specification. If the specified needInitialDot is true the string is only parsed if ‘*start == ’.'and a @ref format_error exception is thrown if the string following the initial dot is empty. If an error occurs throw an exception of type @ref format_error , otherwise update the outputstart` iterator to point to the first unparsed character of the string and store the parsed result into this object.

◆ parse() [2/2]

template<class t_ITER >
BSLS_KEYWORD_CONSTEXPR_CPP20 void bslfmt::FormatterSpecificationNumericValue::parse ( t_ITER *  start,
t_ITER  end,
bool  needInitialDot 
)

◆ postprocess()

template<typename t_FORMAT_CONTEXT >
void bslfmt::FormatterSpecificationNumericValue::postprocess ( const t_FORMAT_CONTEXT &  context)
inline

If this object holds a non-dynamic nested value (i.e., d_type is e_ARG_ID) update its value using the arguments stored in the specified context and update the type to e_VALUE. If this object holds a dynamic nested value (i.e., d_type is e_NEXT_ARG) throw an exception of type format_error . Otherwise do nothing.

◆ value()

BSLS_KEYWORD_CONSTEXPR_CPP20 int bslfmt::FormatterSpecificationNumericValue::value ( ) const
inline

Return the value attribute of this object.

Precondition
The behavior is undefined if category is either e_DEFAULT or e_NEXT_ARG_ID.

Friends And Related Symbol Documentation

◆ FormatterSpecificationNumericValue_ArgVisitor


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