BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balcl::TypeInfoUtil Struct Reference

#include <balcl_typeinfo.h>

Static Public Member Functions

static bool satisfiesConstraint (const OptionValue &element, const TypeInfo &typeInfo)
 
static bool satisfiesConstraint (const OptionValue &element, const TypeInfo &typeInfo, bsl::ostream &stream)
 
static bool satisfiesConstraint (const void *variable, const TypeInfo &typeInfo)
 
static bool satisfiesConstraint (const void *variable, const TypeInfo &typeInfo, bsl::ostream &stream)
 
static bool parseAndValidate (OptionValue *element, const bsl::string_view &input, const TypeInfo &typeInfo, bsl::ostream &stream, TypeInfo::ParseInputSource inputSource=TypeInfo::e_COMMAND_LINE)
 
static int tokenizeArrayEnvironmentVariable (bsl::vector< bsl::string > *tokens, const bsl::string_view &input)
 

Detailed Description

This utility struct provides a namespace for functions that perform non-primitive operations using TypeInfo objects.

Member Function Documentation

◆ parseAndValidate()

static bool balcl::TypeInfoUtil::parseAndValidate ( OptionValue element,
const bsl::string_view input,
const TypeInfo typeInfo,
bsl::ostream &  stream,
TypeInfo::ParseInputSource  inputSource = TypeInfo::e_COMMAND_LINE 
)
static

Load into the specified element the result of parsing the specified input as a value of the element->type(). Return true if input is parsed without error and the value satisfies the constraint of the specified typeInfo object (if any), and false with no effect on element otherwise. If the operation fails, a descriptive error message indicating the reason for the failure is written to the specified stream. IftypeInfo' holds no constraint that validation is considered true; nevertheless, the parse might still fail due to problems with the input format. Optionally specify inputSource indicating the source of the option text being parsed. If inputSource is not provided, input is treated as if it came from the command line. inputSource is used in handling boolean options. Boolean options supplied by command line should not have associated text, where as boolean options supplied by the environment should have the values "0", "1", "true", or "false". The behavior is undefined unless element->type() == typeInfo.type().

◆ satisfiesConstraint() [1/4]

static bool balcl::TypeInfoUtil::satisfiesConstraint ( const OptionValue element,
const TypeInfo typeInfo 
)
static

◆ satisfiesConstraint() [2/4]

static bool balcl::TypeInfoUtil::satisfiesConstraint ( const OptionValue element,
const TypeInfo typeInfo,
bsl::ostream &  stream 
)
static

Return true if the specified element satisfies the constraint of the specified typeInfo object (if any), and false otherwise. Optionally specify a stream; if stream is specified and validation fails, a descriptive error message indicating the reason for the failure is written to stream. If typeInfo holds no constraint, this method returns true. The behavior is undefined unless element.type() == typeInfo.type().

◆ satisfiesConstraint() [3/4]

static bool balcl::TypeInfoUtil::satisfiesConstraint ( const void *  variable,
const TypeInfo typeInfo 
)
static

◆ satisfiesConstraint() [4/4]

static bool balcl::TypeInfoUtil::satisfiesConstraint ( const void *  variable,
const TypeInfo typeInfo,
bsl::ostream &  stream 
)
static

Return true if the value at the specified variable satisfies the constraint of the specified typeInfo object (if any), and false otherwise. Optionally specify a stream; if stream is specified and validation fails, a descriptive error message indicating the reason for the failure is written to stream. If typeInfo holds no constraint, this method returns true. The behavior is undefined unless variable can be (validly) cast to OptionType<ENUM>::EnumToType::type * where ENUM matches typeInfo.type().

◆ tokenizeArrayEnvironmentVariable()

static int balcl::TypeInfoUtil::tokenizeArrayEnvironmentVariable ( bsl::vector< bsl::string > *  tokens,
const bsl::string_view input 
)
static

Load the specified tokens with the specified input broken up into substrings separated by , except that characters following '\' are not to be interpreted as separators. It is an error for input to contain a '\' that is not followed by another '\' or . Return 0 on success, and a negative value on failure.


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