BDE 4.14.0 Production release
|
Classes | |
struct | bdlat_SymbolicConverter |
class | bdlat_SymbolicConverter_Imp |
class | bdlat_SymbolicConverter_StoreValue< LVALUE_TYPE > |
class | bdlat_SymbolicConverter_LoadValue< RVALUE_TYPE > |
class | bdlat_SymbolicConverter_StoreInSequence< SEQUENCE_TYPE > |
class | bdlat_SymbolicConverter_StoreInChoice< CHOICE_TYPE > |
class | bdlat_SymbolicConverter_StoreInArrayElement< ARRAY_TYPE > |
class | bdlat_SymbolicConverter_StoreInNullable< NULLABLE_TYPE > |
struct | bdlat_SymbolicConverter_Imp_resolveDynamicRhsProxy< LHS_TYPE, LHS_CATEGORY > |
Component-private struct. Do not use. More... | |
struct | bdlat_SymbolicConverter_Imp_resolveDynamicLhsProxy< RHS_TYPE, RHS_CATEGORY > |
Component-private struct. Do not use. More... | |
Functions | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Sequence lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Sequence rhsCategory) |
Convert to sequence from sequence. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Choice lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Choice rhsCategory) |
Convert to choice from choice. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Array lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Array rhsCategory) |
Convert to array from array. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Enumeration lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Enumeration rhsCategory) |
Convert to enum from enum. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Enumeration lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Simple rhsCategory) |
Convert to enum from simple type. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Simple lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Enumeration rhsCategory) |
Convert to simple type from enum. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::NullableValue lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::NullableValue rhsCategory) |
Convert to nullable from nullable. | |
template<class LHS_TYPE , class RHS_TYPE , class RHS_CATEGORY > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::NullableValue lhsCategory, const RHS_TYPE &rhs, RHS_CATEGORY rhsCategory) |
Convert to nullable from non-nullable. | |
template<class LHS_TYPE , class LHS_CATEGORY , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, LHS_CATEGORY lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::NullableValue rhsCategory) |
Convert to non-nullable from nullable. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::CustomizedType lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::NullableValue rhsCategory) |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::CustomizedType lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::CustomizedType rhsCategory) |
Convert to customized from customized. | |
template<class LHS_TYPE , class RHS_TYPE , class RHS_CATEGORY > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::CustomizedType lhsCategory, const RHS_TYPE &rhs, RHS_CATEGORY rhsCategory) |
Convert to customized from non-customized. | |
template<class LHS_TYPE , class LHS_CATEGORY , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, LHS_CATEGORY lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::CustomizedType rhsCategory) |
Convert to non-customized from customized. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::NullableValue lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::CustomizedType rhsCategory) |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, bdlat_TypeCategory::Simple lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Simple rhsCategory) |
template<class LHS_TYPE , class LHS_CATEGORY , class RHS_TYPE , class RHS_CATEGORY > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, LHS_CATEGORY lhsCategory, const RHS_TYPE &rhs, RHS_CATEGORY rhsCategory) |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::resolveDynamicTypes (LHS_TYPE *lhs, bdlat_TypeCategory::DynamicType lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::DynamicType rhsCategory) |
Resolve dynamic types. | |
template<class LHS_TYPE , class RHS_TYPE , class RHS_CATEGORY > | |
int | bdlat_SymbolicConverter_Imp::resolveDynamicTypes (LHS_TYPE *lhs, bdlat_TypeCategory::DynamicType lhsCategory, const RHS_TYPE &rhs, RHS_CATEGORY rhsCategory) |
template<class LHS_TYPE , class LHS_CATEGORY , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::resolveDynamicTypes (LHS_TYPE *lhs, LHS_CATEGORY lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::DynamicType rhsCategory) |
template<class LHS_TYPE , class LHS_CATEGORY , class RHS_TYPE , class RHS_CATEGORY > | |
int | bdlat_SymbolicConverter_Imp::resolveDynamicTypes (LHS_TYPE *lhs, LHS_CATEGORY lhsCategory, const RHS_TYPE &rhs, RHS_CATEGORY rhsCategory) |
bdlat_SymbolicConverter_Imp::bdlat_SymbolicConverter_Imp (bsl::ostream *errorStream) | |
Create the imp object. | |
template<class LHS_TYPE , class RHS_TYPE > | |
int | bdlat_SymbolicConverter_Imp::convert (LHS_TYPE *lhs, const RHS_TYPE &rhs) |
Implementation for convert function. | |
bsl::ostream & | bdlat_SymbolicConverter_Imp::errorStream () |
Return a reference to the error stream. | |
bdlat_SymbolicConverter_StoreValue< LVALUE_TYPE >::bdlat_SymbolicConverter_StoreValue (LVALUE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp) | |
template<class RVALUE_TYPE , class INFO_TYPE > | |
int | bdlat_SymbolicConverter_StoreValue< LVALUE_TYPE >::operator() (const RVALUE_TYPE &object, const INFO_TYPE &) const |
Assign the specified object to *d_lValue_p . | |
template<class RVALUE_TYPE > | |
int | bdlat_SymbolicConverter_StoreValue< LVALUE_TYPE >::operator() (const RVALUE_TYPE &object) const |
Assign the specified object to *d_lValue_p . | |
bdlat_SymbolicConverter_LoadValue< RVALUE_TYPE >::bdlat_SymbolicConverter_LoadValue (const RVALUE_TYPE &value, bdlat_SymbolicConverter_Imp *imp) | |
template<class LVALUE_TYPE , class INFO_TYPE > | |
int | bdlat_SymbolicConverter_LoadValue< RVALUE_TYPE >::operator() (LVALUE_TYPE *object, const INFO_TYPE &) const |
Assign d_value to the specified *object . | |
template<class LVALUE_TYPE > | |
int | bdlat_SymbolicConverter_LoadValue< RVALUE_TYPE >::operator() (LVALUE_TYPE *object) const |
Assign d_value to the specified *object . | |
bdlat_SymbolicConverter_StoreInSequence< SEQUENCE_TYPE >::bdlat_SymbolicConverter_StoreInSequence (SEQUENCE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp) | |
template<class SOURCE_MEMBER_TYPE , class INFO_TYPE > | |
int | bdlat_SymbolicConverter_StoreInSequence< SEQUENCE_TYPE >::operator() (const SOURCE_MEMBER_TYPE &sourceMember, const INFO_TYPE &info) const |
bdlat_SymbolicConverter_StoreInChoice< CHOICE_TYPE >::bdlat_SymbolicConverter_StoreInChoice (CHOICE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp) | |
template<class SOURCE_MEMBER_TYPE , class INFO_TYPE > | |
int | bdlat_SymbolicConverter_StoreInChoice< CHOICE_TYPE >::operator() (const SOURCE_MEMBER_TYPE &sourceMember, const INFO_TYPE &info) const |
bdlat_SymbolicConverter_StoreInArrayElement< ARRAY_TYPE >::bdlat_SymbolicConverter_StoreInArrayElement (ARRAY_TYPE *array, int index, bdlat_SymbolicConverter_Imp *imp) | |
template<class SOURCE_ELEMENT_TYPE > | |
int | bdlat_SymbolicConverter_StoreInArrayElement< ARRAY_TYPE >::operator() (const SOURCE_ELEMENT_TYPE &sourceElement) const |
bdlat_SymbolicConverter_StoreInNullable< NULLABLE_TYPE >::bdlat_SymbolicConverter_StoreInNullable (NULLABLE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp) | |
template<class VALUE_TYPE > | |
int | bdlat_SymbolicConverter_StoreInNullable< NULLABLE_TYPE >::operator() (const VALUE_TYPE &value) const |
template<class LHS_TYPE , class RHS_TYPE > | |
static int | bdlat_SymbolicConverter::convert (LHS_TYPE *lhs, const RHS_TYPE &rhs) |
template<class LHS_TYPE , class RHS_TYPE > | |
static int | bdlat_SymbolicConverter::convert (LHS_TYPE *lhs, const RHS_TYPE &rhs, bsl::ostream &errorStream) |
Provide a utility for convert types with matching member symbols.
The bdlat_SymbolicConverter
utility provided by this component defines a single parameterized function convert
. The convert
function takes two arguments: a destination and a source object. The destination and source objects may be of different types.
Each type can fall into one of the following categories:
The bdlat_SymbolicConverter
utility converts from one type to another using the following criteria:
Any other combination of destination and source categories will fail to convert.
This section illustrates intended use of this component.
This component can be used with types supported by the bdlat
framework. In particular, types generated by the bas_codegen.pl
tool can be used. For example, suppose we have the following XML schema inside a file called xsdfile.xsd
:
Using the bas_codegen.pl
tool, we can generate C++ classes for this schema:
This tool will generate the header and implementation files for the test_employee and test_trainee components in the current directory.
Now suppose we want to create a hireTrainee
function, that converts a trainee to an employee. Such a function could be written as follows:
The hireTrainee
function can be used as follows:
|
inline |
|
inlineexplicit |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
int bdlat_SymbolicConverter_Imp::convert | ( | LHS_TYPE * | lhs, |
bdlat_TypeCategory::Array | lhsCategory, | ||
const RHS_TYPE & | rhs, | ||
bdlat_TypeCategory::Array | rhsCategory | ||
) |
int bdlat_SymbolicConverter_Imp::convert | ( | LHS_TYPE * | lhs, |
bdlat_TypeCategory::Choice | lhsCategory, | ||
const RHS_TYPE & | rhs, | ||
bdlat_TypeCategory::Choice | rhsCategory | ||
) |
|
inline |
int bdlat_SymbolicConverter_Imp::convert | ( | LHS_TYPE * | lhs, |
bdlat_TypeCategory::CustomizedType | lhsCategory, | ||
const RHS_TYPE & | rhs, | ||
bdlat_TypeCategory::NullableValue | rhsCategory | ||
) |
Convert to customized type from nullable. Note that this overload is required to resolve ambiguities when there are nullable and customized types in the same sequence.
int bdlat_SymbolicConverter_Imp::convert | ( | LHS_TYPE * | lhs, |
bdlat_TypeCategory::CustomizedType | lhsCategory, | ||
const RHS_TYPE & | rhs, | ||
RHS_CATEGORY | rhsCategory | ||
) |
|
inline |
|
inline |
|
inline |
Convert to nullable from customized. Note that this overload is required to resolve ambiguities when there are nullable and customized types in the same sequence.
int bdlat_SymbolicConverter_Imp::convert | ( | LHS_TYPE * | lhs, |
bdlat_TypeCategory::NullableValue | lhsCategory, | ||
const RHS_TYPE & | rhs, | ||
bdlat_TypeCategory::NullableValue | rhsCategory | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
Convert to simple from simple of the same type. Note that this just evaluates to an assignment using the assignment operator.
|
inlinestatic |
Convert the value of the specified rhs
object to the specified (modifiable) lhs
object. Optionally specify an errorStream
to print error messages. Return 0 on success and a non-zero value otherwise. The supported conversions are described in the bdlat_symbolicconverter component-level documentation.
|
inline |
|
inlinestatic |
|
inline |
int bdlat_SymbolicConverter_Imp::convert | ( | LHS_TYPE * | lhs, |
LHS_CATEGORY | lhsCategory, | ||
const RHS_TYPE & | rhs, | ||
bdlat_TypeCategory::NullableValue | rhsCategory | ||
) |
|
inline |
No match found. This function does nothing, it just returns a FAILURE code (to be used to detect type-mismatch at runtime).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int bdlat_SymbolicConverter_StoreInChoice< CHOICE_TYPE >::operator() | ( | const SOURCE_MEMBER_TYPE & | sourceMember, |
const INFO_TYPE & | info | ||
) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |