xo-reflect: + TypeDescr:: n_child_fixed(), fixed_child_td(i)

This commit is contained in:
Roland Conybeare 2024-06-25 19:37:16 -04:00
commit 2b9aff3640
9 changed files with 56 additions and 2 deletions

View file

@ -26,6 +26,7 @@ namespace xo {
virtual uint32_t n_child(void * object) const override = 0;
virtual uint32_t n_child_fixed() const override = 0;
virtual TaggedPtr child_tp(uint32_t i, void * object) const override = 0;
virtual TypeDescr fixed_child_td(uint32_t i) const override = 0;
/* (forbidden) */
virtual std::string const & struct_member_name(uint32_t i) const override;
}; /*VectorTdx*/
@ -33,6 +34,7 @@ namespace xo {
// ----- StlVectorTdx -----
/* require:
* - VectorT::value_type
* - VectorT.size()
* - VectorT[int] :: lvalue
*/
@ -60,6 +62,10 @@ namespace xo {
return establish_most_derived_tp(&((*vec)[i]));
} /*child_tp*/
virtual TypeDescr fixed_child_td(uint32_t /*i*/) const override {
return EstablishTypeDescr::establish<typename VectorT::value_type>();
}
}; /*StlVectorTdx*/
// ----- std::array<Element, N> -----
@ -105,6 +111,10 @@ namespace xo {
return establish_most_derived_tp(&((*vec)[i]));
}
virtual TypeDescr fixed_child_td(uint32_t /*i*/) const override {
return EstablishTypeDescr::establish<Element>();
}
}; /*StdVectorTdx*/
} /*namespace reflect*/