xo-object2: + DBoolean w/ AGCObject, APrintable facets

This commit is contained in:
Roland Conybeare 2026-01-23 15:44:13 -05:00
commit b456d7ac85
12 changed files with 390 additions and 0 deletions

View file

@ -4,6 +4,7 @@ set(SELF_LIB xo_object2)
set(SELF_SRCS
IGCObject_DArray.cpp
IGCObject_DFloat.cpp
IGCObject_DBoolean.cpp
IGCObject_DInteger.cpp
IGCObject_DList.cpp
IGCObject_DString.cpp
@ -11,6 +12,7 @@ set(SELF_SRCS
ISequence_DArray.cpp
ISequence_DList.cpp
IPrintable_DList.cpp
IPrintable_DBoolean.cpp
IPrintable_DFloat.cpp
IPrintable_DInteger.cpp
IPrintable_DString.cpp
@ -18,6 +20,7 @@ set(SELF_SRCS
DList.cpp
DFloat.cpp
DInteger.cpp
DBoolean.cpp
DString.cpp
init_object2.cpp
object2_register_types.cpp

57
src/object2/DBoolean.cpp Normal file
View file

@ -0,0 +1,57 @@
/** @file DBoolean.cpp
*
* @author Roland Conybeare, Jan 2026
**/
#include "DBoolean.hpp"
#include <xo/indentlog/print/pretty.hpp>
#include <xo/indentlog/scope.hpp>
namespace xo {
using xo::facet::typeseq;
using xo::print::ppdetail_atomic;
namespace scm {
DBoolean *
DBoolean::_box(obj<AAllocator> mm, bool x)
{
void * mem = mm.alloc(typeseq::id<DBoolean>(),
sizeof(DBoolean));
return new (mem) DBoolean(x);
}
bool
DBoolean::pretty(const ppindentinfo & ppii) const
{
return ppdetail_atomic<long>::print_pretty(ppii, value_);
}
size_t
DBoolean::shallow_size() const noexcept
{
return sizeof(DBoolean);
}
DBoolean *
DBoolean::shallow_copy(obj<AAllocator> mm) const noexcept
{
DBoolean * copy = (DBoolean *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
}
size_t
DBoolean::forward_children(obj<ACollector>) noexcept
{
return shallow_size();
}
} /*namespace scm*/
} /*namespace xo*/
/* end DBoolean.cpp */

View file

@ -0,0 +1,39 @@
/** @file IGCObject_DBoolean.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DBoolean.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DBoolean.json5]
**/
#include "boolean/IGCObject_DBoolean.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DBoolean::shallow_size(const DBoolean & self) noexcept -> size_type
{
return self.shallow_size();
}
auto
IGCObject_DBoolean::shallow_copy(const DBoolean & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DBoolean::forward_children(DBoolean & self, obj<ACollector> gc) noexcept -> size_type
{
return self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DBoolean.cpp */

View file

@ -0,0 +1,28 @@
/** @file IPrintable_DBoolean.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IPrintable_DBoolean.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IPrintable_DBoolean.json5]
**/
#include "boolean/IPrintable_DBoolean.hpp"
namespace xo {
namespace scm {
auto
IPrintable_DBoolean::pretty(const DBoolean & self, const ppindentinfo & ppii) -> bool
{
return self.pretty(ppii);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IPrintable_DBoolean.cpp */

View file

@ -7,11 +7,13 @@
#include <xo/object2/array/IGCObject_DArray.hpp>
#include <xo/object2/list/IGCObject_DList.hpp>
#include <xo/object2/boolean/IGCObject_DBoolean.hpp>
#include <xo/object2/number/IGCObject_DFloat.hpp>
#include <xo/object2/number/IGCObject_DInteger.hpp>
#include <xo/object2/string/IGCObject_DString.hpp>
#include <xo/object2/list/IPrintable_DList.hpp>
#include <xo/object2/boolean/IPrintable_DBoolean.hpp>
#include <xo/object2/number/IPrintable_DFloat.hpp>
#include <xo/object2/number/IPrintable_DInteger.hpp>
#include <xo/object2/string/IPrintable_DString.hpp>
@ -29,9 +31,11 @@ namespace xo {
using xo::mm::AAllocator;
using xo::mm::AGCObject;
using xo::scm::DList;
using xo::scm::DBoolean;
using xo::scm::DFloat;
using xo::scm::DString;
using xo::scm::DArray;
using xo::facet::DVariantPlaceholder;
using xo::facet::FacetRegistry;
using xo::facet::typeseq;
@ -45,6 +49,9 @@ namespace xo {
FacetRegistry::register_impl<APrintable, DList>();
FacetRegistry::register_impl<ASequence, DList>();
FacetRegistry::register_impl<AGCObject, DBoolean>();
FacetRegistry::register_impl<APrintable, DBoolean>();
FacetRegistry::register_impl<AGCObject, DFloat>();
FacetRegistry::register_impl<APrintable, DFloat>();
@ -57,7 +64,10 @@ namespace xo {
FacetRegistry::register_impl<AGCObject, DArray>();
FacetRegistry::register_impl<ASequence, DArray>();
log && log(xtag("DVariantPlaceholder.tseq", typeseq::id<DVariantPlaceholder>()));
log && log(xtag("DList.tseq", typeseq::id<DList>()));
log && log(xtag("DBoolean.tseq", typeseq::id<DFloat>()));
log && log(xtag("DFloat.tseq", typeseq::id<DFloat>()));
log && log(xtag("DInteger.tseq", typeseq::id<DInteger>()));
log && log(xtag("DString.tseq", typeseq::id<DString>()));

View file

@ -5,6 +5,7 @@
#include "object2_register_types.hpp"
#include "boolean/IGCObject_DBoolean.hpp"
#include "number/IGCObject_DFloat.hpp"
#include "number/IGCObject_DInteger.hpp"
#include "string/IGCObject_DString.hpp"
@ -33,6 +34,8 @@ namespace xo {
bool ok = true;
ok &= gc.install_type(impl_for<AGCObject, DBoolean>());
ok &= gc.install_type(impl_for<AGCObject, DFloat>());
ok &= gc.install_type(impl_for<AGCObject, DInteger>());