Quick Links:

bal | bbl | bdl | bsl

Classes | Public Types | Static Public Member Functions | Static Public Attributes

balcl::OptionType Struct Reference

#include <balcl_optiontype.h>

List of all members.

Classes

struct  EnumToType
struct  TypeToEnum

Public Types

enum  Enum {
  e_VOID, e_BOOL, e_CHAR, e_INT,
  e_INT64, e_DOUBLE, e_STRING, e_DATETIME,
  e_DATE, e_TIME, e_CHAR_ARRAY, e_INT_ARRAY,
  e_INT64_ARRAY, e_DOUBLE_ARRAY, e_STRING_ARRAY, e_DATETIME_ARRAY,
  e_DATE_ARRAY, e_TIME_ARRAY
}
 

Enumerate the set of value types available for command-line options.

More...
typedef bool Bool
typedef char Char
typedef int Int
typedef bsls::Types::Int64 Int64
typedef double Double
typedef bsl::string String
typedef bdlt::Datetime Datetime
typedef bdlt::Date Date
typedef bdlt::Time Time
typedef bsl::vector< char > CharArray
typedef bsl::vector< int > IntArray
typedef bsl::vector
< bsls::Types::Int64
Int64Array
typedef bsl::vector< double > DoubleArray
typedef bsl::vector< bsl::stringStringArray
typedef bsl::vector
< bdlt::Datetime
DatetimeArray
typedef bsl::vector< bdlt::DateDateArray
typedef bsl::vector< bdlt::TimeTimeArray

Static Public Member Functions

static Enum fromArrayType (Enum type)
static bool isArrayType (Enum type)
static Enum toArrayType (Enum type)
static bsl::ostream & print (bsl::ostream &stream, OptionType::Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii (OptionType::Enum value)

Static Public Attributes

static Bool *const k_BOOL
static Char *const k_CHAR
static Int *const k_INT
static Int64 *const k_INT64
static Double *const k_DOUBLE
static String *const k_STRING
static Datetime *const k_DATETIME
static Date *const k_DATE
static Time *const k_TIME
static CharArray *const k_CHAR_ARRAY
static IntArray *const k_INT_ARRAY
static Int64Array *const k_INT64_ARRAY
static DoubleArray *const k_DOUBLE_ARRAY
static StringArray *const k_STRING_ARRAY
static DatetimeArray *const k_DATETIME_ARRAY
static DateArray *const k_DATE_ARRAY
static TimeArray *const k_TIME_ARRAY

Detailed Description

This struct provides a namespace for enumerating types used for command-line option values. See Enumerators for details.

This struct:

For terminology bsldoc_glossary.

See Component balcl_optiontype


Member Typedef Documentation

typedef double balcl::OptionType::Double

Member Enumeration Documentation

Enumerator:
e_VOID 
e_BOOL 
e_CHAR 
e_INT 
e_INT64 
e_DOUBLE 
e_STRING 
e_DATETIME 
e_DATE 
e_TIME 
e_CHAR_ARRAY 
e_INT_ARRAY 
e_INT64_ARRAY 
e_DOUBLE_ARRAY 
e_STRING_ARRAY 
e_DATETIME_ARRAY 
e_DATE_ARRAY 
e_TIME_ARRAY 

Member Function Documentation

static Enum balcl::OptionType::fromArrayType ( Enum  type  )  [static]

If isArrayType(type) for the specified type, then return the type of the elements of that array type; otherwise return e_VOID.

static bool balcl::OptionType::isArrayType ( Enum  type  )  [static]

Return true if the specified type corresponds to an array type, and false otherwise.

static Enum balcl::OptionType::toArrayType ( Enum  type  )  [static]

If there is an array type whose elements have the specified type then return that array type; otherwise return e_VOID. e_VOID == toArrayType(e_BOOL) because an array of boolean values is not allowed as a command-line-option type. Note that type == fromArrayType(TYPE) when TYPE != e_VOID is returned.

static bsl::ostream& balcl::OptionType::print ( bsl::ostream &  stream,
OptionType::Enum  value,
int  level = 0,
int  spacesPerLevel = 4 
) [static]

Write the string representation of the specified enumeration value to the specified output stream, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). See toAscii for what constitutes the string representation of a OptionType::Enum value.

static const char* balcl::OptionType::toAscii ( OptionType::Enum  value  )  [static]

Return the (non-modifiable) string representation corresponding to the specified enumeration value, if it exists, and a unique (error) string otherwise. The string representation of value matches its corresponding enumerator name with the e_ prefix elided. For example:

will print the following on standard output:

          STRING

Note that specifying a value that does not match any of the enumerators will result in a string representation that is distinct from any of those corresponding to the enumerators, but is otherwise unspecified.


Member Data Documentation

Int* const balcl::OptionType::k_INT [static]

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