xo-object2: APrintable+DFloat

This commit is contained in:
Roland Conybeare 2026-01-05 11:53:44 -05:00
commit a903a058f1
9 changed files with 112 additions and 9 deletions

View file

@ -6,11 +6,13 @@
#pragma once
#include <xo/alloc2/Allocator.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
namespace xo {
namespace scm {
struct DFloat {
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
explicit DFloat(double x) : value_{x} {}
@ -20,6 +22,8 @@ namespace xo {
double value() const noexcept { return value_; }
bool pretty(const ppindentinfo & ppii) const;
operator double() const noexcept { return value_; }
private:

View file

@ -0,0 +1,58 @@
/** @file IPrintable_DFloat.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IPrintable_DFloat.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IPrintable_DFloat.json5]
**/
#pragma once
#include <xo/printable2/Printable.hpp>
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
#include "DFloat.hpp"
namespace xo { namespace scm { class IPrintable_DFloat; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::print::APrintable,
xo::scm::DFloat>
{
using ImplType = xo::print::IPrintable_Xfer
<xo::scm::DFloat,
xo::scm::IPrintable_DFloat>;
};
}
}
namespace xo {
namespace scm {
/** @class IPrintable_DFloat
**/
class IPrintable_DFloat {
public:
/** @defgroup scm-printable-dfloat-type-traits **/
///@{
using ppindentinfo = xo::print::APrintable::ppindentinfo;
///@}
/** @defgroup scm-printable-dfloat-methods **/
///@{
/** Pretty-printing support for this object.
See [xo-indentlog/xo/indentlog/pretty.hpp]
**/
static bool pretty(const DFloat & self, const ppindentinfo & ppii);
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */