xo-objectd2 xo-printable xo-facet: pp working for List(Integer)

Also streamline facet switching
This commit is contained in:
Roland Conybeare 2026-01-09 17:48:54 -05:00
commit 09ee3a20ac
23 changed files with 508 additions and 27 deletions

View file

@ -18,4 +18,7 @@
#include "detail/IPrintable_Xfer.hpp"
#include "detail/RPrintable.hpp"
/* end Printable.hpp */
// todo: additional includes in idl above
#include "detail/ppdetail_Printable.hpp"
/* end Printable.hpp */

View file

@ -47,7 +47,7 @@ public:
/** Pretty-printing support for this object.
See [xo-indentlog/xo/indentlog/pretty.hpp]
**/
virtual bool pretty(Copaque data, const ppindentinfo & ppii) = 0;
virtual bool pretty(Copaque data, const ppindentinfo & ppii) const = 0;
// nonconst methods
///@}

View file

@ -56,7 +56,7 @@ namespace print {
// const methods
typeseq _typeseq() const noexcept override { return s_typeseq; }
[[noreturn]] bool pretty(Copaque, const ppindentinfo &) override { _fatal(); }
[[noreturn]] bool pretty(Copaque, const ppindentinfo &) const override { _fatal(); }
// nonconst methods
@ -83,4 +83,4 @@ namespace print {
} /*namespace print */
} /*namespace xo */
/* IPrintable_Any.hpp */
/* IPrintable_Any.hpp */

View file

@ -41,7 +41,7 @@ namespace print {
// const methods
typeseq _typeseq() const noexcept override { return s_typeseq; }
bool pretty(Copaque data, const ppindentinfo & ppii) override {
bool pretty(Copaque data, const ppindentinfo & ppii) const override {
return I::pretty(_dcast(data), ppii);
}
@ -78,4 +78,4 @@ namespace print {
} /*namespace print */
} /*namespace xo*/
/* end IPrintable_Xfer.hpp */
/* end IPrintable_Xfer.hpp */

View file

@ -31,6 +31,7 @@ public:
using ObjectType = Object;
using DataPtr = Object::DataPtr;
using ppindentinfo = APrintable::ppindentinfo;
using typeseq = xo::facet::typeseq;
///@}
/** @defgroup print-printable-router-ctors **/
@ -46,8 +47,8 @@ public:
///@{
// const methods
int32_t _typeseq() const noexcept { return O::iface()->_typeseq(); }
bool pretty(const ppindentinfo & ppii) {
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
bool pretty(const ppindentinfo & ppii) const {
return O::iface()->pretty(O::data(), ppii);
}

View file

@ -0,0 +1,21 @@
/** @file ppdetail_Printable.hpp
*
* @author Roland Conybeare, Jan 2026
**/
#include <xo/indentlog/print/pretty.hpp>
#include "Printable.hpp"
namespace xo {
namespace print {
template <typename DRepr>
struct ppdetail<xo::facet::obj<APrintable, DRepr>> {
static bool print_pretty(const ppindentinfo & ppii,
const xo::facet::obj<APrintable, DRepr> & x) {
return x.pretty(ppii);
}
};
}
} /*namespace xo*/
/* end ppdetail_Printable.hpp */