xo-facet xo-object2 : tidy: ISequence_DList -> list/ subdir

This commit is contained in:
Roland Conybeare 2026-01-15 00:05:48 -05:00
commit e625a362a6
15 changed files with 73 additions and 51 deletions

View file

@ -504,7 +504,6 @@ def main():
idl_fname=idl_fname,
idl=idl,
output_hpp_dir=output_hpp_dir,
#output_impl_hpp_dir=output_impl_hpp_dir,
output_cpp_dir=output_cpp_dir)
elif idl['mode'] == 'implementation':
# idl: json5 for (iface, data) combination
@ -517,7 +516,7 @@ def main():
idl_fname=idl_fname,
idl=idl,
facet_idl=facet_idl,
output_hpp_dir=output_hpp_dir,
output_hpp_dir=output_impl_hpp_dir,
output_impl_hpp_subdir=output_impl_hpp_subdir,
output_cpp_dir=output_cpp_dir)

View file

@ -11,7 +11,7 @@
* [{{ idl_fname }}]
**/
#include "{{iface_facet_repr_hpp_fname}}"
#include "{{impl_hpp_subdir}}/{{iface_facet_repr_hpp_fname}}"
namespace {{repr_ns1}} {
namespace {{repr_ns2}} {

View file

@ -6,13 +6,14 @@
* arguments:
* --input [{{genfacet_input}}]
* 2. jinja2 template for abstract facet .hpp file:
* [{{ iface_facet_any_hpp_j2 }}]
* [{{ iface_facet_repr_hpp_j2 }}]
* 3. idl for facet methods
* [{{ idl_fname }}]
**/
#pragma once
#include "{{facet_hpp_fname}}"
{% for include_fname in facet_includes %}
#include {{include_fname}}
{% endfor %}

View file

@ -36,7 +36,7 @@ xo_add_genfacetimpl(
REPR List
INPUT idl/ISequence_DList.json5
OUTPUT_HPP_DIR include/xo/object2
OUTPUT_IMPL_SUBDIR sequence
OUTPUT_IMPL_SUBDIR list
OUTPUT_CPP_DIR src/object2
)

View file

@ -1,6 +1,7 @@
{
mode: "implementation",
includes: [ "<xo/printable2/Printable.hpp>" ],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Sequence.json5",

View file

@ -1,8 +1,12 @@
{
mode: "facet",
includes: ["<xo/gc/GCObject.hpp>"],
// extra includes in Sequence.hpp, if any
user_hpp_includes: [],
namespace1: "xo",
namespace2: "scm",
// text after includes, before ASequence
pretext: [ "// {pretext} here" ],
facet: "Sequence",
detail_subdir: "sequence",
brief: "an ordered collection of variants",

View file

@ -2,13 +2,13 @@
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [./idl/Sequence.json5]
* --input [idl/Sequence.json5]
* 2. jinja2 template for facet .hpp file:
* [facet.hpp.j2]
* 3. idl for facet methods
* [./idl/Sequence.json5]
* [idl/Sequence.json5]
**/
#pragma once
@ -18,4 +18,5 @@
#include "sequence/ISequence_Xfer.hpp"
#include "sequence/RSequence.hpp"
/* end Sequence.hpp */

View file

@ -6,7 +6,7 @@
* arguments:
* --input [idl/ISequence_DList.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/ISequence_DList.json5]
**/
@ -14,7 +14,7 @@
#pragma once
#include "Sequence.hpp"
#include "sequence/ISequence_Xfer.hpp"
#include <xo/printable2/Printable.hpp>
#include "DList.hpp"
namespace xo { namespace scm { class ISequence_DList; } }
@ -40,11 +40,14 @@ namespace xo {
public:
/** @defgroup scm-sequence-dlist-type-traits **/
///@{
using size_type = ASequence::size_type;
using AGCObject = ASequence::AGCObject;
using size_type = xo::scm::ASequence::size_type;
using AGCObject = xo::scm::ASequence::AGCObject;
using Copaque = xo::scm::ASequence::Copaque;
using Opaque = xo::scm::ASequence::Opaque;
///@}
/** @defgroup scm-sequence-dlist-methods **/
///@{
// const methods
/** true iff sequence is empty **/
static bool is_empty(const DList & self) noexcept;
/** true iff sequence is finite **/
@ -52,6 +55,7 @@ namespace xo {
/** return element @p index of this sequence **/
static obj<AGCObject> at(const DList & self, size_type index);
// non-const methods
///@}
};

View file

@ -2,13 +2,13 @@
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [./idl/Sequence.json5]
* --input [idl/Sequence.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [abstract_facet.hpp.j2]
* 3. idl for facet methods
* [./idl/Sequence.json5]
* [idl/Sequence.json5]
**/
#pragma once
@ -19,6 +19,8 @@
#include <xo/facet/facet_implementation.hpp>
#include <xo/facet/typeseq.hpp>
// {pretext} here
namespace xo {
namespace scm {
@ -36,6 +38,8 @@ public:
// types
/** integer identifying a type **/
using typeseq = xo::facet::typeseq;
using Copaque = const void *;
using Opaque = void *;
/** type for length of a sequence **/
using size_type = std::size_t;
/** facet for types with GC support **/
@ -48,11 +52,11 @@ public:
/** RTTI: unique id# for actual runtime data representation **/
virtual typeseq _typeseq() const noexcept = 0;
/** true iff sequence is empty **/
virtual bool is_empty(Copaque data) const noexcept = 0;
virtual bool is_empty(Copaque data) const noexcept = 0;
/** true iff sequence is finite **/
virtual bool is_finite(Copaque data) const noexcept = 0;
virtual bool is_finite(Copaque data) const noexcept = 0;
/** return element @p index of this sequence **/
virtual obj<AGCObject> at(Copaque data, size_type index) const = 0;
virtual obj<AGCObject> at(Copaque data, size_type index) const = 0;
// nonconst methods
///@}
@ -74,4 +78,4 @@ using ISequence_ImplType = xo::facet::FacetImplType<ASequence, DRepr>;
} /*namespace scm*/
} /*namespace xo*/
/* */
/* ASequence.hpp */

View file

@ -2,19 +2,18 @@
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [./idl/Sequence.json5]
* --input [idl/Sequence.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [./idl/Sequence.json5]
* [idl/Sequence.json5]
**/
#pragma once
#include "ASequence.hpp"
#include <xo/facet/typeseq.hpp>
#include <xo/facet/obj.hpp>
namespace xo { namespace scm { class ISequence_Any; } }
@ -43,6 +42,7 @@ namespace scm {
/** @defgroup scm-sequence-any-type-traits **/
///@{
/** integer identifying a type **/
using typeseq = xo::facet::typeseq;
using size_type = ASequence::size_type;
using AGCObject = ASequence::AGCObject;
@ -57,16 +57,16 @@ namespace scm {
// const methods
typeseq _typeseq() const noexcept override { return s_typeseq; }
[[noreturn]] bool is_empty(Copaque) const noexcept override { _fatal(); }
[[noreturn]] bool is_finite(Copaque) const noexcept override { _fatal(); }
[[noreturn]] obj<AGCObject> at(Copaque, size_type) const override { _fatal(); }
[[noreturn]] bool is_empty(Copaque) const noexcept override { _fatal(); }
[[noreturn]] bool is_finite(Copaque) const noexcept override { _fatal(); }
[[noreturn]] obj<AGCObject> at(Copaque, size_type) const override { _fatal(); }
// nonconst methods
///@}
private:
/** @defgroup scm-sequence-any-private-methods **/
/** @defgraoup scm-sequence-any-private-methods **/
///@{
[[noreturn]] static void _fatal();
@ -86,4 +86,4 @@ namespace scm {
} /*namespace scm */
} /*namespace xo */
/* ISequence_Any.hpp */
/* ISequence_Any.hpp */

View file

@ -2,18 +2,18 @@
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [./idl/Sequence.json5]
* --input [idl/Sequence.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [./idl/Sequence.json5]
* [idl/Sequence.json5]
**/
#pragma once
#include "ASequence.hpp"
#include <xo/gc/GCObject.hpp>
namespace xo {
namespace scm {
@ -24,7 +24,10 @@ namespace scm {
public:
/** @defgroup scm-sequence-xfer-type-traits **/
///@{
/** actual implementation (not generated; often delegates to DRepr) **/
using Impl = ISequence_DRepr;
/** integer identifying a type **/
using typeseq = ASequence::typeseq;
using size_type = ASequence::size_type;
using AGCObject = ASequence::AGCObject;
///@}
@ -39,13 +42,13 @@ namespace scm {
// const methods
typeseq _typeseq() const noexcept override { return s_typeseq; }
bool is_empty(Copaque data) const noexcept override {
bool is_empty(Copaque data) const noexcept override {
return I::is_empty(_dcast(data));
}
bool is_finite(Copaque data) const noexcept override {
bool is_finite(Copaque data) const noexcept override {
return I::is_finite(_dcast(data));
}
obj<AGCObject> at(Copaque data, size_type index) const override {
obj<AGCObject> at(Copaque data, size_type index) const override {
return I::at(_dcast(data), index);
}
@ -82,4 +85,4 @@ namespace scm {
} /*namespace scm */
} /*namespace xo*/
/* end ISequence_Xfer.hpp */
/* end ISequence_Xfer.hpp */

View file

@ -2,13 +2,13 @@
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [./idl/Sequence.json5]
* --input [idl/Sequence.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [./idl/Sequence.json5]
* [idl/Sequence.json5]
**/
#pragma once
@ -30,6 +30,7 @@ public:
///@{
using ObjectType = Object;
using DataPtr = Object::DataPtr;
using typeseq = xo::reflect::typeseq;
using size_type = ASequence::size_type;
using AGCObject = ASequence::AGCObject;
///@}
@ -38,26 +39,27 @@ public:
///@{
RSequence() {}
RSequence(Object::DataPtr data) : Object{std::move(data)} {}
RSequence(const ASequence * iface, void * data)
requires std::is_same_v<typename Object::DataType, xo::facet::DVariantPlaceholder>
: Object(iface, data) {}
///@}
/** @defgroup scm-sequence-router-methods **/
///@{
// const methods
int32_t _typeseq() const noexcept { return O::iface()->_typeseq(); }
bool is_empty() const noexcept override {
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
bool is_empty() const noexcept {
return O::iface()->is_empty(O::data());
}
bool is_finite() const noexcept override {
bool is_finite() const noexcept {
return O::iface()->is_finite(O::data());
}
obj<AGCObject> at(size_type index) const override {
obj<AGCObject> at(size_type index) const {
return O::iface()->at(O::data(), index);
}
// non-const methods
// << do something for non-const methods >>
//
// non-const methods (still const in router!)
///@}
/** @defgroup scm-sequence-member-vars **/

View file

@ -32,7 +32,10 @@ bool
ISequence_Any::_valid
= valid_facet_implementation<ASequence, ISequence_Any>();
// nonconst methods
} /*namespace scm*/
} /*namespace xo*/
/* end ISequence_Any.cpp */
/* end ISequence_Any.cpp */

View file

@ -11,8 +11,7 @@
* [idl/ISequence_DList.json5]
**/
#include "IGCObject_DList.hpp" // apparently need this with clang 15
#include "ISequence_DList.hpp"
#include "list/ISequence_DList.hpp"
namespace xo {
namespace scm {
@ -38,4 +37,4 @@ namespace xo {
} /*namespace scm*/
} /*namespace xo*/
/* end ISequence_DList.cpp */
/* end ISequence_DList.cpp */

View file

@ -5,7 +5,8 @@
user_hpp_includes: ["\"detail/ppdetail_Printable.hpp\""],
namespace1: "xo",
namespace2: "print",
pretext: [],
// text after includes, before APrintable
pretext: [ "// {pretext} here" ],
facet: "Printable",
detail_subdir: "detail",
brief: "pretty-printable objects",