diff --git a/xo-alloc/include/xo/alloc/GcStatistics.hpp b/xo-alloc/include/xo/alloc/GcStatistics.hpp index b591bf22..69053457 100644 --- a/xo-alloc/include/xo/alloc/GcStatistics.hpp +++ b/xo-alloc/include/xo/alloc/GcStatistics.hpp @@ -1,16 +1,16 @@ -/* GcStatistics.hpp +/** @file GcStatistics.hpp * - * author: Roland Conybeare, Aug 2025 - */ + * @author Roland Conybeare, Aug 2025 + **/ #pragma once #include "generation.hpp" #include "CircularBuffer.hpp" -#include "xo/reflect/TypeDescr.hpp" -#include "xo/unit/quantity.hpp" -#include "xo/unit/quantity_iostream.hpp" -#include "xo/indentlog/print/pretty.hpp" +#include +#include +#include +#include #include #include diff --git a/xo-reflect/include/xo/reflect/TypeDescr.hpp b/xo-reflect/include/xo/reflect/TypeDescr.hpp index d39d64e8..4b3ca87b 100644 --- a/xo-reflect/include/xo/reflect/TypeDescr.hpp +++ b/xo-reflect/include/xo/reflect/TypeDescr.hpp @@ -3,7 +3,8 @@ #pragma once #include "TypeDescrExtra.hpp" -#include "xo/cxxutil/demangle.hpp" +#include +#include #include #include #include @@ -15,6 +16,8 @@ #include namespace xo { + namespace print { class ppindentinfo; } + namespace reflect { class TaggedPtr; /* see [reflect/TaggedPtr.hpp] */ @@ -202,6 +205,9 @@ namespace xo { /* run-time description for a native c++ type */ class TypeDescrBase { + public: + using ppindentinfo = xo::print::ppindentinfo; + public: /* type-description objects for a type T is unique, * --> can always use its address @@ -391,6 +397,9 @@ namespace xo { TypeDescr fn_arg(uint32_t i) const { return this->tdextra_->fn_arg(i); } bool fn_is_noexcept() const { return this->tdextra_->fn_is_noexcept(); } + /** pretty-printer support, using @p ppii **/ + bool pretty(const ppindentinfo & ppii) const; + void display(std::ostream & os) const; std::string display_string() const; @@ -543,7 +552,6 @@ namespace xo { return os; } - /* tag to drive overload resolution */ struct reflected_types_printer {}; @@ -567,6 +575,24 @@ namespace xo { static TypeDescrTable s_instance; }; } /*namespace reflect*/ + + namespace print { + template <> + struct ppdetail { + static bool print_pretty(const ppindentinfo & ppii, + const xo::reflect::TypeDescrBase & td) { + return td.pretty(ppii); + } + }; + + template <> + struct ppdetail { + static bool print_pretty(const ppindentinfo & ppii, + xo::reflect::TypeDescr td) { + return td ? td->pretty(ppii) : true; + } + }; + } /*namespace print*/ } /*namespace xo*/ namespace std { diff --git a/xo-reflect/src/reflect/TypeDescr.cpp b/xo-reflect/src/reflect/TypeDescr.cpp index de5f4ada..c6cb1664 100644 --- a/xo-reflect/src/reflect/TypeDescr.cpp +++ b/xo-reflect/src/reflect/TypeDescr.cpp @@ -301,6 +301,19 @@ namespace xo { return this->tdextra_->child_tp(i, object); } /*child_tp*/ + bool + TypeDescrBase::pretty(const ppindentinfo & ppii) const + { + return ppii.pps()->pretty_struct + (ppii, + "TypeDescr", + refrtag("id", id_), + refrtag("canonical_name", canonical_name_), + refrtag("complete", complete_flag_), + refrtag("metatype", this->metatype())); + + } + void TypeDescrBase::display(std::ostream & os) const {