@@ -52,13 +52,51 @@ namespace daw::json_to_cpp::types {
5252 return *this ;
5353 }
5454
55- std::string name ( ) const noexcept ;
56- std::string json_name ( std::string member_name ) const noexcept ;
57- std::string array_member_info ( ) const ;
55+ inline std::string name ( ) const noexcept {
56+ return daw::visit_nt ( value,
57+ []( auto const &item ) { return item.name ( ); } );
58+ }
59+
60+ inline std::string json_name ( std::string member_name ) const noexcept {
61+ return daw::visit_nt ( value, [&member_name]( auto const &item ) {
62+ return item.json_name ( member_name );
63+ } );
64+ }
5865
59- daw::ordered_map<std::string, ti_types_t > const &children ( ) const ;
60- daw::ordered_map<std::string, ti_types_t > &children ( );
66+ inline std::string array_member_info ( ) const {
67+ return daw::visit_nt (
68+ value, []( auto const &item ) { return item.array_member_info ( ); } );
69+ }
6170
71+ inline daw::ordered_map<std::string, ti_types_t > const &children ( ) const {
72+ return daw::visit_nt (
73+ value,
74+ []( ti_array const &v )
75+ -> daw::ordered_map<std::string, ti_types_t > const & {
76+ return *v.children ;
77+ },
78+ []( ti_object const &v )
79+ -> daw::ordered_map<std::string, ti_types_t > const & {
80+ return *v.children ;
81+ },
82+ []( ... ) -> daw::ordered_map<std::string, ti_types_t > const & {
83+ std::terminate ( );
84+ } );
85+ }
86+
87+ inline daw::ordered_map<std::string, ti_types_t > &children ( ) {
88+ return daw::visit_nt (
89+ value,
90+ []( ti_array &v ) -> daw::ordered_map<std::string, ti_types_t > & {
91+ return *v.children ;
92+ },
93+ []( ti_object &v ) -> daw::ordered_map<std::string, ti_types_t > & {
94+ return *v.children ;
95+ },
96+ []( ... ) -> daw::ordered_map<std::string, ti_types_t > & {
97+ std::terminate ( );
98+ } );
99+ }
62100 template <typename Function>
63101 constexpr void on_children ( Function ) const {}
64102
0 commit comments