|
| #define | CXXMCP_REFL_IMPL_1(T, f1) |
| |
| #define | CXXMCP_REFL_IMPL_2(T, f1, f2) |
| |
| #define | CXXMCP_REFL_IMPL_3(T, f1, f2, f3) |
| |
| #define | CXXMCP_REFL_IMPL_4(T, f1, f2, f3, f4) |
| |
| #define | CXXMCP_REFL_IMPL_5(T, f1, f2, f3, f4, f5) |
| |
| #define | CXXMCP_REFL_IMPL_6(T, f1, f2, f3, f4, f5, f6) |
| |
| #define | CXXMCP_REFL_IMPL_7(T, f1, f2, f3, f4, f5, f6, f7) |
| |
| #define | CXXMCP_REFL_IMPL_8(T, f1, f2, f3, f4, f5, f6, f7, f8) |
| |
| #define | CXXMCP_REFL_IMPL_9(T, f1, f2, f3, f4, f5, f6, f7, f8, f9) |
| |
| #define | CXXMCP_REFL_IMPL_10(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) |
| |
| #define | CXXMCP_REFL_IMPL_11(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) |
| |
| #define | CXXMCP_REFL_IMPL_12(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12) |
| |
| #define | CXXMCP_REFL_IMPL_13(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13) |
| |
| #define | CXXMCP_REFL_IMPL_14(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14) |
| |
| #define | CXXMCP_REFL_IMPL_15(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15) |
| |
| #define | CXXMCP_REFL_IMPL_16(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16) |
| |
|
#define | CXXMCP_REFLECT_CHOOSER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, NAME, ...) NAME |
| |
|
#define | CXXMCP_REFLECT_EXPAND(expr) expr |
| |
| #define | CXXMCP_REFLECT(Type, ...) |
| | One-line Reflect<T> specialization.
|
| |
| #define | CXXMCP_REFL_SELF_IMPL_1(T, f1) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_2(T, f1, f2) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_3(T, f1, f2, f3) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_4(T, f1, f2, f3, f4) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_5(T, f1, f2, f3, f4, f5) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_6(T, f1, f2, f3, f4, f5, f6) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_7(T, f1, f2, f3, f4, f5, f6, f7) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_8(T, f1, f2, f3, f4, f5, f6, f7, f8) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_9(T, f1, f2, f3, f4, f5, f6, f7, f8, f9) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_10(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_11(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_12(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_13(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_14(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_15(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15) |
| |
| #define | CXXMCP_REFL_SELF_IMPL_16(T, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16) |
| |
|
#define | CXXMCP_REFLECT_SELF_CHOOSER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, NAME, ...) NAME |
| |
| #define | CXXMCP_REFLECT_SELF(Type, ...) |
| | Intrusive reflection helper for DTOs you own.
|
| |
| #define | CXXMCP_REFLECT_CHECK(Struct, expected_count) |
| | Validates that a Reflect<> specialization covers the expected number of fields.
|
| |
|
|
template<typename Struct , typename Field > |
| constexpr FieldDescriptor< Struct, Field > | mcp::protocol::field (const char *wire_name, Field Struct::*pointer) |
| | Creates a FieldDescriptor with wire name and pointer-to-member.
|
| |
|
template<typename Struct , typename Field > |
| constexpr FieldDescriptor< Struct, Field > | mcp::protocol::validated_field (const char *wire_name, Field Struct::*pointer, core::Result< core::Unit >(*validator)(const Field &)) |
| | Creates a FieldDescriptor with a post-deserialization validator.
|
| |
|
template<typename Struct > |
| ExtensionsField< Struct > | mcp::protocol::extensions_field (Json Struct::*pointer, std::vector< std::string > own_keys) |
| | Creates an ExtensionsField descriptor.
|
| |
|
template<typename Struct , typename Field > |
| constexpr DeserializeOnlyField< Struct, Field > | mcp::protocol::deserialize_only (const char *wire_name, Field Struct::*pointer) |
| | Creates a DeserializeOnlyField descriptor.
|
| |
| template<typename Struct , typename Field > |
| constexpr FieldDescriptor< Struct, Field > | mcp::protocol::nullable_field (const char *wire_name, Field Struct::*pointer) |
| | Creates a FieldDescriptor whose missing wire value maps to std::monostate.
|
| |
|
template<typename Struct , typename Field > |
| constexpr FieldDescriptor< Struct, Field > | mcp::protocol::defaulted_field (const char *wire_name, Field Struct::*pointer) |
| | Creates a FieldDescriptor whose missing wire value keeps the C++ default value.
|
| |
| template<typename S , typename F > |
| void | mcp::protocol::detail::push_wire_name (std::vector< std::string > &keys, const FieldDescriptor< S, F > &fd) |
| | Overloads that extract wire_name from field descriptors.
|
| |
|
template<typename S , typename F > |
| void | mcp::protocol::detail::push_wire_name (std::vector< std::string > &keys, const DeserializeOnlyField< S, F > &fd) |
| |
|
template<typename S > |
| void | mcp::protocol::detail::push_wire_name (std::vector< std::string > &, const ExtensionsField< S > &) |
| |
| template<typename T > |
| auto | mcp::protocol::reflect_fields () |
| | Returns the field descriptors for a reflectable type.
|
| |
| template<typename T > |
| std::vector< std::string > | mcp::protocol::extract_known_keys () |
| | Extracts known wire names from the fields() tuple at runtime.
|
| |
| template<typename T > |
| Json | mcp::protocol::reflect_to_json (const T &obj) |
| | Serializes a DTO to JSON using its Reflect<T> trait.
|
| |
| template<typename T > |
| core::Result< T > | mcp::protocol::reflect_from_json (const Json &json) |
| | Deserializes a DTO from JSON using its Reflect<T> trait.
|
| |
|
template<typename Struct , typename Field > |
| void | mcp::protocol::serialize_one (Json &json, const Struct &obj, const FieldDescriptor< Struct, Field > &fd) |
| | Serializes a single field into the JSON object.
|
| |
|
template<typename Struct , typename Field > |
| void | mcp::protocol::serialize_one (Json &, const Struct &, const DeserializeOnlyField< Struct, Field > &) |
| | No-op for deserialize-only fields during serialization.
|
| |
|
template<typename Struct > |
| void | mcp::protocol::serialize_one (Json &json, const Struct &obj, const ExtensionsField< Struct > &fd) |
| | Merges extension members into the parent JSON object.
|
| |
| template<typename Struct , typename Field > |
| bool | mcp::protocol::deserialize_one (const Json &json, Struct &obj, const FieldDescriptor< Struct, Field > &fd, core::Result< core::Unit > &status) |
| | Deserializes a single field from the JSON object.
|
| |
|
template<typename Struct > |
| bool | mcp::protocol::deserialize_one (const Json &, Struct &, const ExtensionsField< Struct > &, core::Result< core::Unit > &) |
| | No-op for extensions fields during deserialization.
|
| |
|
template<typename Struct , typename Field > |
| bool | mcp::protocol::deserialize_one (const Json &json, Struct &obj, const DeserializeOnlyField< Struct, Field > &fd, core::Result< core::Unit > &status) |
| | Deserializes a deserialize-only field.
|
| |
C++17 tuple-reflection infrastructure for zero-boilerplate DTO serialization.
Each DTO that opts into reflection provides a Reflect<T> specialization with fields() returning a tuple of FieldDescriptor. The generic reflect_to_json() and reflect_from_json<T>() functions then handle serialization automatically. known_keys() is optional; when absent, wire names are extracted from the fields() tuple at runtime.
Type-specific logic is dispatched through JsonFieldTraits<T> partial specializations for optional, vector, string, enum, variant, and nested-DTO types.