3434 void convertTo(ToVariantConverter&, const Type&)
3535 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
3636// ------------------------------------------------------------------------------
37- #define CPPWAMP_CONVERSION_SPLIT_FREE (Type ) \
38- void convert (FromVariantConverter& c, Type& obj) \
39- { \
40- convertFrom (c, obj); \
41- } \
42- \
43- void convert (ToVariantConverter& c, Type& obj) \
44- { \
45- convertTo (c, const_cast <const Type&>(obj)); \
37+ #define CPPWAMP_CONVERSION_SPLIT_FREE (Type ) \
38+ inline void convert (::wamp:: FromVariantConverter& c, Type& obj) \
39+ { \
40+ convertFrom (c, obj); \
41+ } \
42+ \
43+ inline void convert (::wamp:: ToVariantConverter& c, Type& obj) \
44+ { \
45+ convertTo (c, const_cast <const Type&>(obj)); \
4646}
4747
4848// ------------------------------------------------------------------------------
@@ -63,16 +63,16 @@ void convert(ToVariantConverter& c, Type& obj) \
6363 void CustomType::convertTo(ToVariantConverter&) const
6464 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
6565// ------------------------------------------------------------------------------
66- #define CPPWAMP_CONVERSION_SPLIT_MEMBER (Type ) \
67- void convert (FromVariantConverter& c, Type& obj) \
68- { \
69- ConversionAccess::convertFrom (c, obj); \
70- } \
71- \
72- void convert (ToVariantConverter& c, Type& obj) \
73- { \
74- const auto & constObj = obj; \
75- ConversionAccess::convertTo (c, constObj); \
66+ #define CPPWAMP_CONVERSION_SPLIT_MEMBER (Type ) \
67+ inline void convert (::wamp:: FromVariantConverter& c, Type& obj) \
68+ { \
69+ wamp:: ConversionAccess::convertFrom (c, obj); \
70+ } \
71+ \
72+ inline void convert (::wamp:: ToVariantConverter& c, Type& obj) \
73+ { \
74+ const auto & constObj = obj; \
75+ wamp:: ConversionAccess::convertTo (c, constObj); \
7676}
7777
7878namespace wamp
@@ -115,6 +115,10 @@ class ToVariantConverter
115115 template <typename T>
116116 ToVariantConverter& operator ()(String key, T&& value);
117117
118+ /* * Appends an object member to the variant. */
119+ template <typename T, typename U>
120+ ToVariantConverter& operator ()(String key, T&& value, U&& ignored);
121+
118122 /* * Returns a reference to the wrapped variant. */
119123 Variant& variant ();
120124
@@ -160,6 +164,11 @@ class FromVariantConverter
160164 template <typename T>
161165 FromVariantConverter& operator ()(const String& key, T& value);
162166
167+ /* * Retrieves a member from an Object variant, with a fallback value
168+ if the member is not found. */
169+ template <typename T, typename U>
170+ FromVariantConverter& operator ()(const String& key, T& value, U&& fallback);
171+
163172 /* * Returns a constant reference to the wrapped variant. */
164173 const Variant& variant () const ;
165174
0 commit comments