xo-alloc/xo-facet
2026-01-21 17:35:01 -05:00
..
cmake refactor: move xo::facet::typeseq to xo-reflectutil/ 2026-01-05 21:49:33 -05:00
codegen xo-facet xo-object2 : tidy: ISequence_DList -> list/ subdir 2026-01-15 00:05:48 -05:00
docs xo-facet: runtime facet lookup [PROTO] 2026-01-09 10:07:20 -05:00
include/xo/facet xo-reader2: DefineSsm: respond to = token 2026-01-21 17:35:01 -05:00
utest xo-facet: + FacetRegistry tidy 2026-01-08 19:46:32 -05:00
CMakeLists.txt refactor: move xo::facet::typeseq to xo-reflectutil/ 2026-01-05 21:49:33 -05:00
README.md + xo-printable2 + build fixes for cmake config 2026-01-04 23:03:18 -05:00

xo-facet

Codegen

To scaffold a new facet Foo we need several c++ classes

  • AFoo abstract FOMO interface, with opaque data pointer
  • IFoo_Any variant placeholder, all methods terminate
  • IFoo_Xfer template, delegates methods to a separate implementation class
  • RFoo template, inherits from a 2x-wide fat pointer (iface+data).

These classes all have parallel methods Can generate these as follows:

  1. write xo-foo/idl/Foo.json5.

    Supply attributes:

    • mode :: string
    • includes :: [string]
    • namespace1 :: string
    • namespace2 :: string
    • facet :: string
    • detail_subdir :: string
    • brief :: string
    • using_doxygen :: bool
    • doc :: [string]
    • types :: [{name, doc, definition}]
    • const_methods :: [{name, doc, return_type, args, const, noexcept, attributes}]
    • nonconst_methods :: [{name, doc, return_type, args, const, noexcept, attributes}]

Example in xo-object2/idl/Sequence.json5

  1. generate:
$ cd xo-foo
$ ../xo-facet/codegen/genfacet.py --input ./idl/Foo.json5 --output include/xo/foo2

Alternatively in xo-foo/CMakeLists.txt

xo_add_genfacet(
    TARGET xo-foo2-facet-foo
    FACET Foo
    INPUT idl/Foo.json5
    OUTPUT_HTTP_DIR include/xo/foo2
    OUTPUT_IMPL_SUBDIR detail
    OUTPUT_CPP_DIR src/foo2)

then generate with:

cmake --build path/to/build -- xo-foo2-facet-foo