8#ifndef INCLUDED_BDLAT_SYMBOLICCONVERTER
9#define INCLUDED_BDLAT_SYMBOLICCONVERTER
262#include <bdlscm_version.h>
281#include <bsl_ostream.h>
282#include <bsl_string.h>
299 template <
class LHS_TYPE,
class RHS_TYPE>
301 int convert(LHS_TYPE *lhs,
const RHS_TYPE &rhs);
302 template <
class LHS_TYPE,
class RHS_TYPE>
304 int convert(LHS_TYPE *lhs,
const RHS_TYPE &rhs, bsl::ostream &errorStream);
319 bsl::ostream *d_errorStream_p;
325 template <
class LHS_TYPE,
class RHS_TYPE>
332 template <
class LHS_TYPE,
class RHS_TYPE>
339 template <
class LHS_TYPE,
class RHS_TYPE>
346 template <
class LHS_TYPE,
class RHS_TYPE>
353 template <
class LHS_TYPE,
class RHS_TYPE>
360 template <
class LHS_TYPE,
class RHS_TYPE>
367 template <
class LHS_TYPE,
class RHS_TYPE>
374 template <
class LHS_TYPE,
class RHS_TYPE,
class RHS_CATEGORY>
378 RHS_CATEGORY rhsCategory);
381 template <
class LHS_TYPE,
class LHS_CATEGORY,
class RHS_TYPE>
383 LHS_CATEGORY lhsCategory,
390 template <
class LHS_TYPE,
class RHS_TYPE>
397 template <
class LHS_TYPE,
class RHS_TYPE>
404 template <
class LHS_TYPE,
class RHS_TYPE,
class RHS_CATEGORY>
408 RHS_CATEGORY rhsCategory);
411 template <
class LHS_TYPE,
class LHS_CATEGORY,
class RHS_TYPE>
413 LHS_CATEGORY lhsCategory,
420 template <
class LHS_TYPE,
class RHS_TYPE>
428 template <
class LHS_TYPE,
class RHS_TYPE>
436 template <
class LHS_TYPE,
441 LHS_CATEGORY lhsCategory,
443 RHS_CATEGORY rhsCategory);
446 template <
class LHS_TYPE,
class RHS_TYPE>
451 template <
class LHS_TYPE,
457 RHS_CATEGORY rhsCategory);
458 template <
class LHS_TYPE,
462 LHS_CATEGORY lhsCategory,
465 template <
class LHS_TYPE,
470 LHS_CATEGORY lhsCategory,
472 RHS_CATEGORY rhsCategory);
491 template <
class LHS_TYPE,
class RHS_TYPE>
493 const RHS_TYPE& rhs);
507template <
class LVALUE_TYPE>
511 LVALUE_TYPE *d_destination_p;
517 LVALUE_TYPE *destination,
523 template <
class RVALUE_TYPE,
class INFO_TYPE>
525 const INFO_TYPE&)
const;
528 template <
class RVALUE_TYPE>
529 int operator()(
const RVALUE_TYPE&
object)
const;
539template <
class RVALUE_TYPE>
544 const RVALUE_TYPE& d_value;
549 const RVALUE_TYPE& value,
555 template <
class LVALUE_TYPE,
class INFO_TYPE>
557 const INFO_TYPE&)
const;
560 template <
class LVALUE_TYPE>
576template <
class SEQUENCE_TYPE>
580 SEQUENCE_TYPE *d_destination_p;
586 SEQUENCE_TYPE *destination,
590 template <
class SOURCE_MEMBER_TYPE,
class INFO_TYPE>
591 int operator()(
const SOURCE_MEMBER_TYPE& sourceMember,
592 const INFO_TYPE& info)
const;
602template <
class CHOICE_TYPE>
606 CHOICE_TYPE *d_destination_p;
612 CHOICE_TYPE *destination,
616 template <
class SOURCE_MEMBER_TYPE,
class INFO_TYPE>
617 int operator()(
const SOURCE_MEMBER_TYPE& sourceMember,
618 const INFO_TYPE& info)
const;
629template <
class ARRAY_TYPE>
633 ARRAY_TYPE *d_array_p;
645 template <
class SOURCE_ELEMENT_TYPE>
646 int operator()(
const SOURCE_ELEMENT_TYPE& sourceElement)
const;
656template <
class NULLABLE_TYPE>
660 NULLABLE_TYPE *d_destination_p;
666 NULLABLE_TYPE *destination,
670 template <
class VALUE_TYPE>
671 int operator()(
const VALUE_TYPE& value)
const;
683template <
class LHS_TYPE,
class LHS_CATEGORY>
696 template <
class TYPE>
704 template <
class TYPE,
class ANY_CATEGORY>
720template <
class RHS_TYPE,
class RHS_CATEGORY>
733 template <
class TYPE>
741 template <
class TYPE,
class ANY_CATEGORY>
762template <
class LHS_TYPE,
class RHS_TYPE>
774template <
class LHS_TYPE,
class RHS_TYPE>
780 enum { k_SUCCESS = 0 };
794template <
class LHS_TYPE,
class RHS_TYPE>
800 enum { k_SUCCESS = 0, k_FAILURE = -4 };
806 for (
int i = 0; i < size; ++i) {
808 storeInLhs(lhs, i,
this);
818template <
class LHS_TYPE,
class RHS_TYPE>
831 static_cast<int>(str.
length()));
834template <
class LHS_TYPE,
class RHS_TYPE>
844template <
class LHS_TYPE,
class RHS_TYPE>
854template <
class LHS_TYPE,
class RHS_TYPE>
861 enum { k_SUCCESS = 0 };
874template <
class LHS_TYPE,
class RHS_TYPE,
class RHS_CATEGORY>
884 return storeInLhs(rhs);
887template <
class LHS_TYPE,
class LHS_CATEGORY,
class RHS_TYPE>
894 enum { k_SUCCESS = 0 };
906template <
class LHS_TYPE,
class RHS_TYPE>
913 enum { k_SUCCESS = 0 };
925template <
class LHS_TYPE,
class RHS_TYPE>
937template <
class LHS_TYPE,
class RHS_TYPE,
class RHS_CATEGORY>
944 enum { k_FAILURE = -5 };
949 LhsBaseType lhsBaseValue;
951 if (0 !=
convert(&lhsBaseValue, rhs)) {
959template <
class LHS_TYPE,
class LHS_CATEGORY,
class RHS_TYPE>
971template <
class LHS_TYPE,
class RHS_TYPE>
983template <
class LHS_TYPE,
class RHS_TYPE>
993template <
class LHS_TYPE,
1003 enum { k_FAILURE = -6 };
1008template <
class LHS_TYPE,
class RHS_TYPE>
1013 const RHS_TYPE& rhs,
1023template <
class LHS_TYPE,
class RHS_TYPE,
class RHS_CATEGORY>
1028 const RHS_TYPE& rhs,
1033 RHS_CATEGORY> proxy = {
this, &rhs };
1038template <
class LHS_TYPE,
class LHS_CATEGORY,
class RHS_TYPE>
1043 const RHS_TYPE& rhs,
1048 LHS_CATEGORY> proxy = {
this, lhs };
1053template <
class LHS_TYPE,
1060 LHS_CATEGORY lhsCategory,
1061 const RHS_TYPE& rhs,
1062 RHS_CATEGORY rhsCategory)
1064 return convert(lhs, lhsCategory, rhs, rhsCategory);
1070bdlat_SymbolicConverter_Imp::bdlat_SymbolicConverter_Imp(
1071 bsl::ostream *errorStream)
1072: d_errorStream_p(errorStream)
1079template <
class LHS_TYPE,
class RHS_TYPE>
1082 const RHS_TYPE& rhs)
1093 return *d_errorStream_p;
1102template <
class LVALUE_TYPE>
1107: d_destination_p(destination)
1114template <
class LVALUE_TYPE>
1115template <
class RVALUE_TYPE,
class INFO_TYPE>
1118 const RVALUE_TYPE&
object,
1119 const INFO_TYPE&)
const
1121 return d_imp_p->convert(d_destination_p,
object);
1124template <
class LVALUE_TYPE>
1125template <
class RVALUE_TYPE>
1128 const RVALUE_TYPE&
object)
const
1130 return d_imp_p->convert(d_destination_p,
object);
1139template <
class RVALUE_TYPE>
1143 const RVALUE_TYPE& value,
1152template <
class RVALUE_TYPE>
1153template <
class LVALUE_TYPE,
class INFO_TYPE>
1156 LVALUE_TYPE *
object,
1157 const INFO_TYPE&)
const
1159 return d_imp_p->convert(
object, d_value);
1162template <
class RVALUE_TYPE>
1163template <
class LVALUE_TYPE>
1166 LVALUE_TYPE *
object)
const
1168 return d_imp_p->convert(
object, d_value);
1177template <
class SEQUENCE_TYPE>
1181 SEQUENCE_TYPE *destination,
1183: d_destination_p(destination)
1190template <
class SEQUENCE_TYPE>
1191template <
class SOURCE_MEMBER_TYPE,
class INFO_TYPE>
1194 const SOURCE_MEMBER_TYPE& sourceMember,
1195 const INFO_TYPE& info)
const
1197 enum { k_SUCCESS = 0, k_FAILURE = -7 };
1206 info.nameLength())) {
1207 d_imp_p->errorStream()
1208 <<
"Failed to convert attribute '"
1223template <
class CHOICE_TYPE>
1228: d_destination_p(destination)
1235template <
class CHOICE_TYPE>
1236template <
class SOURCE_MEMBER_TYPE,
class INFO_TYPE>
1238 const SOURCE_MEMBER_TYPE& sourceMember,
1239 const INFO_TYPE& info)
const
1241 enum { k_SUCCESS = 0, k_FAILURE = -8 };
1247 info.nameLength())) {
1248 d_imp_p->errorStream()
1249 <<
"Failed to make selection '"
1263 d_imp_p->errorStream()
1264 <<
"Failed to convert selection '"
1279template <
class ARRAY_TYPE>
1293template <
class ARRAY_TYPE>
1294template <
class SOURCE_ELEMENT_TYPE>
1297 const SOURCE_ELEMENT_TYPE& sourceElement)
const
1314template <
class NULLABLE_TYPE>
1318 NULLABLE_TYPE *destination,
1320: d_destination_p(destination)
1327template <
class NULLABLE_TYPE>
1328template <
class VALUE_TYPE>
1331 const VALUE_TYPE& value)
const
1348template <
class LHS_TYPE,
class RHS_TYPE>
1351 const RHS_TYPE& rhs)
1353 bsl::ostream nullStream(0);
1357template <
class LHS_TYPE,
class RHS_TYPE>
1360 const RHS_TYPE& rhs,
1361 bsl::ostream& errorStream)
Definition bdlat_symbolicconverter.h:316
~bdlat_SymbolicConverter_Imp()=default
Destroy this object.
Definition bdlat_symbolicconverter.h:540
Definition bdlat_symbolicconverter.h:630
Definition bdlat_symbolicconverter.h:603
Definition bdlat_symbolicconverter.h:657
Definition bdlat_symbolicconverter.h:577
Definition bdlat_symbolicconverter.h:508
Definition bslstl_string.h:1281
size_type length() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_string.h:6601
CHAR_TYPE * data() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_string.h:6477
bdlat_SymbolicConverter_LoadValue(const RVALUE_TYPE &value, bdlat_SymbolicConverter_Imp *imp)
Definition bdlat_symbolicconverter.h:1142
int operator()(const SOURCE_MEMBER_TYPE &sourceMember, const INFO_TYPE &info) const
Definition bdlat_symbolicconverter.h:1237
bsl::ostream & errorStream()
Return a reference to the error stream.
Definition bdlat_symbolicconverter.h:1091
bdlat_SymbolicConverter_StoreInSequence(SEQUENCE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp)
Definition bdlat_symbolicconverter.h:1180
bdlat_SymbolicConverter_StoreInArrayElement(ARRAY_TYPE *array, int index, bdlat_SymbolicConverter_Imp *imp)
Definition bdlat_symbolicconverter.h:1282
int operator()(const SOURCE_ELEMENT_TYPE &sourceElement) const
Definition bdlat_symbolicconverter.h:1296
bdlat_SymbolicConverter_StoreValue(LVALUE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp)
Definition bdlat_symbolicconverter.h:1105
bdlat_SymbolicConverter_StoreInNullable(NULLABLE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp)
Definition bdlat_symbolicconverter.h:1317
int operator()(const VALUE_TYPE &value) const
Definition bdlat_symbolicconverter.h:1330
int operator()(const SOURCE_MEMBER_TYPE &sourceMember, const INFO_TYPE &info) const
Definition bdlat_symbolicconverter.h:1193
bdlat_SymbolicConverter_StoreInChoice(CHOICE_TYPE *destination, bdlat_SymbolicConverter_Imp *imp)
Definition bdlat_symbolicconverter.h:1226
int operator()(LVALUE_TYPE *object, const INFO_TYPE &) const
Assign d_value to the specified *object.
Definition bdlat_symbolicconverter.h:1155
int operator()(const RVALUE_TYPE &object, const INFO_TYPE &) const
Assign the specified object to *d_lValue_p.
Definition bdlat_symbolicconverter.h:1117
int convert(LHS_TYPE *lhs, bdlat_TypeCategory::Sequence lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::Sequence rhsCategory)
Convert to sequence from sequence.
Definition bdlat_symbolicconverter.h:764
static int convert(LHS_TYPE *lhs, const RHS_TYPE &rhs)
Definition bdlat_symbolicconverter.h:1350
int resolveDynamicTypes(LHS_TYPE *lhs, bdlat_TypeCategory::DynamicType lhsCategory, const RHS_TYPE &rhs, bdlat_TypeCategory::DynamicType rhsCategory)
Resolve dynamic types.
Definition bdlat_symbolicconverter.h:1010
static int manipulateByCategory(TYPE *object, MANIPULATOR &manipulator)
Definition bdlat_typecategory.h:1404
static int accessByCategory(const TYPE &object, ACCESSOR &accessor)
Definition bdlat_typecategory.h:1444
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
int manipulateElement(TYPE *array, MANIPULATOR &manipulator, int index)
void resize(TYPE *array, int newSize)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
int accessElement(const TYPE &array, ACCESSOR &accessor, int index)
int manipulateSelection(TYPE *object, MANIPULATOR &manipulator)
int makeSelection(TYPE *object, int selectionId)
int accessSelection(const TYPE &object, ACCESSOR &accessor)
@ k_UNDEFINED_SELECTION_ID
Definition bdlat_choicefunctions.h:511
int selectionId(const TYPE &object)
const BaseType< TYPE >::Type & convertToBaseType(const TYPE &object)
int convertFromBaseType(TYPE *object, const BASE_TYPE &value)
int fromString(TYPE *result, const char *string, int stringLength)
void toString(bsl::string *result, const TYPE &value)
bool isNull(const TYPE &object)
int manipulateValue(TYPE *object, MANIPULATOR &manipulator)
int accessValue(const TYPE &object, ACCESSOR &accessor)
void makeValue(TYPE *object)
int accessAttributes(const TYPE &object, ACCESSOR &accessor)
int manipulateAttribute(TYPE *object, MANIPULATOR &manipulator, const char *attributeName, int attributeNameLength)
void reset(TYPE *object)
Reset the value of the specified object to its default value.
int assign(LHS_TYPE *lhs, const RHS_TYPE &rhs)
StringRefImp< char > StringRef
Definition bslstl_stringref.h:699
TYPE::BaseType Type
Definition bdlat_customizedtypefunctions.h:536
Component-private struct. Do not use.
Definition bdlat_symbolicconverter.h:721
const RHS_TYPE * d_rhs_p
Definition bdlat_symbolicconverter.h:725
int operator()(TYPE *object, ANY_CATEGORY category)
Definition bdlat_symbolicconverter.h:743
bdlat_SymbolicConverter_Imp * d_instance_p
Definition bdlat_symbolicconverter.h:724
int operator()(TYPE *, bslmf::Nil)
Definition bdlat_symbolicconverter.h:735
Component-private struct. Do not use.
Definition bdlat_symbolicconverter.h:684
bdlat_SymbolicConverter_Imp * d_instance_p
Definition bdlat_symbolicconverter.h:687
int operator()(const TYPE &object, ANY_CATEGORY category)
Definition bdlat_symbolicconverter.h:706
int operator()(const TYPE &, bslmf::Nil)
Definition bdlat_symbolicconverter.h:698
LHS_TYPE * d_lhs_p
Definition bdlat_symbolicconverter.h:688
Definition bdlat_symbolicconverter.h:292
Definition bdlat_typecategory.h:1035
Definition bdlat_typecategory.h:1036
Definition bdlat_typecategory.h:1037
Definition bdlat_typecategory.h:1034
Definition bdlat_typecategory.h:1038
Definition bdlat_typecategory.h:1039
Definition bdlat_typecategory.h:1040
Definition bdlat_typecategory.h:1041
This struct is empty and represents a nil type.
Definition bslmf_nil.h:131