BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslfmt::TestSpecificationGenerator< t_CHAR > Class Template Reference

#include <bslfmt_testspecificationgenerator.h>

Detailed Description

template<class t_CHAR>
class bslfmt::TestSpecificationGenerator< t_CHAR >

This class is a generator that provides a set of formatting specifications obtained by exhaustive search of all combinations of standard options. Its use allows easy and thorough testing of formatters for standard types. The generator is a state machine, each state of which corresponds to a separate specification.

See bslfmt_testspecificationgenerator

Public Types

enum  Alignment { e_ALIGN_DEFAULT , e_ALIGN_LEFT , e_ALIGN_MIDDLE , e_ALIGN_RIGHT }
 
enum  Sign { e_SIGN_DEFAULT , e_SIGN_POSITIVE , e_SIGN_NEGATIVE , e_SIGN_SPACE }
 
enum  NestedVariant { e_NESTED_DEFAULT , e_NESTED_ARG_1 , e_NESTED_ARG_2 }
 
enum  FormatType {
  e_TYPE_UNSPECIFIED , e_TYPE_STRING , e_TYPE_ESCAPED , e_TYPE_BINARY ,
  e_TYPE_BINARY_UC , e_TYPE_CHARACTER , e_TYPE_DECIMAL , e_TYPE_OCTAL ,
  e_TYPE_INT_HEX , e_TYPE_INT_HEX_UC , e_TYPE_FLOAT_HEX , e_TYPE_FLOAT_HEX_UC ,
  e_TYPE_SCIENTIFIC , e_TYPE_SCIENTIFIC_UC , e_TYPE_FIXED , e_TYPE_FIXED_UC ,
  e_TYPE_GENERAL , e_TYPE_GENERAL_UC , e_TYPE_POINTER , e_TYPE_POINTER_UC
}
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (TestSpecificationGenerator, bslma::UsesBslmaAllocator)
 
 TestSpecificationGenerator (bslma::Allocator *basicAllocator=0)
 
void addFillCharacter (char character)
 
void addWidth (int width)
 
void addPrecision (int precision)
 
bool next ()
 
bool nextValidForParse ()
 
bool nextValidForFormat ()
 
void setup (const char *instruction=0)
 
const bsl::basic_string< t_CHAR > & spec () const
 
const bsl::basic_string< t_CHAR > & formatSpec () const
 
bool isStateValidForParse () const
 
bool isStateValidForFormat () const
 
bool isValueIdOptionPresent () const
 
bool isFillCharacterPresent () const
 
char fillCharacter () const
 
bool isAlignOptionPresent () const
 
Alignment alignment () const
 
bool isSignOptionPresent () const
 
Sign sign () const
 
bool isHashOptionPresent () const
 
bool isZeroOptionPresent () const
 
bool isWidthOptionPresent () const
 
int width () const
 
bool isNestedWidthPresent () const
 
NestedVariant nestedWidthVariant () const
 
bool isPrecisionOptionPresent () const
 
int precision () const
 
bool isNestedPrecisionPresent () const
 
NestedVariant nestedPrecisionVariant () const
 
bool isLocaleOptionPresent () const
 
bool isTypeOptionPresent () const
 
FormatType type () const
 

Member Enumeration Documentation

◆ Alignment

template<class t_CHAR >
enum bslfmt::TestSpecificationGenerator::Alignment
Enumerator
e_ALIGN_DEFAULT 
e_ALIGN_LEFT 
e_ALIGN_MIDDLE 
e_ALIGN_RIGHT 

◆ FormatType

template<class t_CHAR >
enum bslfmt::TestSpecificationGenerator::FormatType
Enumerator
e_TYPE_UNSPECIFIED 
e_TYPE_STRING 
e_TYPE_ESCAPED 
e_TYPE_BINARY 
e_TYPE_BINARY_UC 
e_TYPE_CHARACTER 
e_TYPE_DECIMAL 
e_TYPE_OCTAL 
e_TYPE_INT_HEX 
e_TYPE_INT_HEX_UC 
e_TYPE_FLOAT_HEX 
e_TYPE_FLOAT_HEX_UC 
e_TYPE_SCIENTIFIC 
e_TYPE_SCIENTIFIC_UC 
e_TYPE_FIXED 
e_TYPE_FIXED_UC 
e_TYPE_GENERAL 
e_TYPE_GENERAL_UC 
e_TYPE_POINTER 
e_TYPE_POINTER_UC 

◆ NestedVariant

Enumerator
e_NESTED_DEFAULT 
e_NESTED_ARG_1 
e_NESTED_ARG_2 

◆ Sign

template<class t_CHAR >
enum bslfmt::TestSpecificationGenerator::Sign
Enumerator
e_SIGN_DEFAULT 
e_SIGN_POSITIVE 
e_SIGN_NEGATIVE 
e_SIGN_SPACE 

Constructor & Destructor Documentation

◆ TestSpecificationGenerator()

template<class t_CHAR >
bslfmt::TestSpecificationGenerator< t_CHAR >::TestSpecificationGenerator ( bslma::Allocator basicAllocator = 0)

Create a generator object. Optionally specify the basicAllocator to supply memory.

Member Function Documentation

◆ addFillCharacter()

template<class t_CHAR >
void bslfmt::TestSpecificationGenerator< t_CHAR >::addFillCharacter ( char  character)

Add the specified character to the set of fill characters.

Note
Note that generated instructions will contain the character only if this function is called before the setup method invocation.

◆ addPrecision()

template<class t_CHAR >
void bslfmt::TestSpecificationGenerator< t_CHAR >::addPrecision ( int  precision)

Add the specified precision to the set of precision values.

Note
Note that generated instructions will contain the precision only if this function is called before the setup method invocation.

◆ addWidth()

template<class t_CHAR >
void bslfmt::TestSpecificationGenerator< t_CHAR >::addWidth ( int  width)

Add the specified width to the set of width values.

Note
Note that generated instructions will contain the width only if this function is called before the setup method invocation.

◆ alignment()

template<class t_CHAR >
TestSpecificationGenerator< t_CHAR >::Alignment bslfmt::TestSpecificationGenerator< t_CHAR >::alignment ( ) const

Return the current alignment type.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

template<class t_CHAR >
bslfmt::TestSpecificationGenerator< t_CHAR >::BSLMF_NESTED_TRAIT_DECLARATION ( TestSpecificationGenerator< t_CHAR >  ,
bslma::UsesBslmaAllocator   
)

◆ fillCharacter()

template<class t_CHAR >
char bslfmt::TestSpecificationGenerator< t_CHAR >::fillCharacter ( ) const

Return the current fill character.

◆ formatSpec()

template<class t_CHAR >
const bsl::basic_string< t_CHAR > & bslfmt::TestSpecificationGenerator< t_CHAR >::formatSpec ( ) const

Return the specification for the formatters format method based on the current state of this object.

◆ isAlignOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isAlignOptionPresent ( ) const

Return true if the align option is present in the current state of this object, and false otherwise.

◆ isFillCharacterPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isFillCharacterPresent ( ) const

Return true if the value id option is present in the current state of this object, and false otherwise.

◆ isHashOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isHashOptionPresent ( ) const

Return true if the alternative form option is present in the current state of this object, and false otherwise.

◆ isLocaleOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isLocaleOptionPresent ( ) const

Return true if the locale option is present in the current state of this object, and false otherwise.

◆ isNestedPrecisionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isNestedPrecisionPresent ( ) const

Return true if the nested precision option is present in the current state of this object, and false otherwise.

◆ isNestedWidthPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isNestedWidthPresent ( ) const

Return true if the nested width option is present in the current state of this object, and false otherwise.

◆ isPrecisionOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isPrecisionOptionPresent ( ) const

Return true if the precision option is present in the current state of this object, and false otherwise.

◆ isSignOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isSignOptionPresent ( ) const

Return true if the sign option is present in the current state of this object, and false otherwise.

◆ isStateValidForFormat()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isStateValidForFormat ( ) const

Return true if the generated specification based on the current state of this object is valid for the formatters format method, and false otherwise.

◆ isStateValidForParse()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isStateValidForParse ( ) const

Return true if the generated specification based on the current state of this object is valid for the formatters parse method, and false otherwise.

◆ isTypeOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isTypeOptionPresent ( ) const

Return true if the presentation type option is present in the current state of this object, and false otherwise.

◆ isValueIdOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isValueIdOptionPresent ( ) const

Return true if the value id option is present in the current state of this object, and false otherwise.

◆ isWidthOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isWidthOptionPresent ( ) const

Return true if the width option is present in the current state of this object, and false otherwise.

◆ isZeroOptionPresent()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::isZeroOptionPresent ( ) const

Return true if the zero option is present in the current state of this object, and false otherwise.

◆ nestedPrecisionVariant()

template<class t_CHAR >
TestSpecificationGenerator< t_CHAR >::NestedVariant bslfmt::TestSpecificationGenerator< t_CHAR >::nestedPrecisionVariant ( ) const

Return the current nested precision variant.

◆ nestedWidthVariant()

template<class t_CHAR >
TestSpecificationGenerator< t_CHAR >::NestedVariant bslfmt::TestSpecificationGenerator< t_CHAR >::nestedWidthVariant ( ) const

Return the current nested width variant.

◆ next()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::next ( )

Switch this object to the next state and generate specification based on the new state.

◆ nextValidForFormat()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::nextValidForFormat ( )

Switch this object to the next state appropriate for generating a specification valid for formatters format method and generate specification based on the new state.

◆ nextValidForParse()

template<class t_CHAR >
bool bslfmt::TestSpecificationGenerator< t_CHAR >::nextValidForParse ( )

Switch this object to the next state appropriate for generating a specification valid for formatters parse method and generate specification based on the new state.

◆ precision()

template<class t_CHAR >
int bslfmt::TestSpecificationGenerator< t_CHAR >::precision ( ) const

Return the current precision value.

◆ setup()

template<class t_CHAR >
void bslfmt::TestSpecificationGenerator< t_CHAR >::setup ( const char *  instruction = 0)

Setup the sequence of this object's states based on the optionally specified instruction.

◆ sign()

template<class t_CHAR >
TestSpecificationGenerator< t_CHAR >::Sign bslfmt::TestSpecificationGenerator< t_CHAR >::sign ( ) const

Return the current sign option value.

◆ spec()

template<class t_CHAR >
const bsl::basic_string< t_CHAR > & bslfmt::TestSpecificationGenerator< t_CHAR >::spec ( ) const

Return the specification for the formatters parse method based on the current state of this object.

◆ type()

template<class t_CHAR >
TestSpecificationGenerator< t_CHAR >::FormatType bslfmt::TestSpecificationGenerator< t_CHAR >::type ( ) const

Return the current presentation type value.

◆ width()

template<class t_CHAR >
int bslfmt::TestSpecificationGenerator< t_CHAR >::width ( ) const

Return the current width value.


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