A general mechanism used in format specification parsers. It supports parsing syntaxes of the form fill‐and‐align?sign # 0 width?precision?L and any syntax that contains a subset of the sections therein.

Synopsis

Declared in <bslfmt_formatspecificationparser.h>

template<class t_CHAR>
class FormatSpecificationParser
    : public FormatSpecificationParserEnums

Base Classes

Name

Description

FormatSpecificationParserEnums

Namespace struct holding enums used for parsing.

Enums

Name

Description

Alignment

Alignment options parsed from a format specification.

ProcessingState

Parser processing states for a format specification.

Sections

Bit flags indicating which format‐spec sections were parsed.

Sign

Sign options parsed from a format specification.

Member Functions

Name

Description

FormatSpecificationParser [constructor]

Create a default instance of FormatSpecificationParser.

alignment

Return the stored alignment value. If parse has not previously been called throw a format_error exception.

alternativeFlag

Return true if parsing detected an alternative processing flag in the specification, otherwise return false. If parse has not previously been called throw a format_error exception.

filler

Return the stored filler string. If parse has not previously been called throw a format_error exception.

fillerCodePointDisplayWidth

Return the width of the filler code point. If postprocess has not previously been called throw a format_error exception.

localeSpecificFlag

Return true if parsing detected a locale‐specific formatting flag in the specification, otherwise return false. If parse has not previously been called throw a format_error exception.

numFillerCharacters

Return the size of the stored filler string. If parse has not previously been called throw a format_error exception.

parse

Parse the string contained by the specified input/output parseContext to extract the items indicated by the specified sections, update this object with the parsing result and update the iterator held by parseContext to point to the start of the unparsed section of the string. In the event of an error throw a format_error exception.

postprocess

Update any nested width and precision values to contain actual values based on the appropriate arguments held by the specified context format context. In the event of an error throw a format_error exception.

postprocessedPrecision

Return the modified numeric precision extracted during postprocessing. If postprocess has not previously been called throw a format_error exception.

postprocessedWidth

Return the modified numeric width extracted during postprocessing. If postprocess has not previously been called throw a format_error exception.

processingState

Return the current processing state of this parser.

rawPrecision

Return the unmodified precision extracted during parsing. If parse has not previously been called throw a format_error exception.

rawWidth

Return the unmodified width extracted during parsing. If parse has not previously been called throw a format_error exception.

remainingSpec

Return that section of the specification string that remains unparsed after the call to parse. Note that this may be a truncated version of the string held by the parse context. If parse has not previously been called throw a format_error exception.

sign

Return the stored sign value. If parse has not previously been called throw a format_error exception.

zeroPaddingFlag

Return true if parsing detected a zero padding flag in the specification, otherwise return false. If parse has not previously been called throw a format_error exception.

Created with MrDocs