BloombergLP::bdlat::EnumUtil::fromStringOrFallbackIfEnabled

Decode an enumeration from a string, using a fallback if needed.

Synopsis

Declared in <bdlat_enumutil.h>

template<class TYPE>
static
int
fromStringOrFallbackIfEnabled(
    TYPE* result,
    char const* string,
    int stringLength);

Description

Load into the specified result the enumerator matching the specified string of the specified stringLength and return 0 if such an enumerator exists. Otherwise, if result supports a fallback enumerator, load into result the fallback enumerator value and return 0. Otherwise, return a non-zero value with no effect on result. The behavior is undefined unless TYPE is a bdlat enumeration type.

Return Value

0 on success, and a non-zero value otherwise

Parameters

NameDescription
resultenumeration object to receive the decoded value
stringstring representation of the enumerator
stringLengthlength of string