xo-reader2: + IPrintable+DDefineSsm

This commit is contained in:
Roland Conybeare 2026-01-20 01:19:47 -05:00
commit 0a7e8468ae
8 changed files with 133 additions and 0 deletions

View file

@ -72,6 +72,18 @@ xo_add_genfacetimpl(
OUTPUT_CPP_DIR src/reader2
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-reader2-facetimpl-printable-definessm
FACET_PKG xo_printable2
FACET Printable
REPR DefineSsm
INPUT idl/IPrintable_DDefineSsm.json5
OUTPUT_HPP_DIR include/xo/reader2
OUTPUT_IMPL_SUBDIR ssm
OUTPUT_CPP_DIR src/reader2
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git

View file

@ -0,0 +1,13 @@
{
mode: "implementation",
includes: [ "<xo/printable2/Printable.hpp>",
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Printable.json5",
brief: "provide APrintable interface for DDefineSsm",
using_doxygen: true,
repr: "DDefineSsm",
doc: [ "implement APrintable for DDefineSsm" ],
}

View file

@ -73,6 +73,7 @@ namespace xo {
public:
using AAllocator = xo::mm::AAllocator;
using DArena = xo::mm::DArena;
using ppindentinfo = xo::print::ppindentinfo;
public:
/** @defgroup scm-define-ssm-facet constructors **/
@ -133,6 +134,12 @@ namespace xo {
ParserStateMachine * p_psm);
///@}
/** @defgroup scm-define-printable-facet printable facet methods **/
///@{
bool pretty(const ppindentinfo & ppii) const;
///@}
private:
/** identify define-expression state **/

View file

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

View file

@ -17,6 +17,7 @@ set(SELF_SRCS
DDefineSsm.cpp
ISyntaxStateMachine_DDefineSsm.cpp
IPrintable_DDefineSsm.cpp
DExpectSymbolSsm.cpp
ISyntaxStateMachine_DExpectSymbolSsm.cpp

View file

@ -494,6 +494,14 @@ namespace xo {
this->get_expect_str());
}
bool
DDefineSsm::pretty(const ppindentinfo & ppii) const
{
return ppii.pps()->pretty_struct
(ppii,
"DDefineSsm",
refrtag("defstate", defstate_));
}
} /*namespace scm*/
} /*namespace xo*/

View file

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

View file

@ -9,6 +9,7 @@
#include <xo/reader2/ssm/IPrintable_DExprSeqState.hpp>
#include <xo/reader2/ssm/ISyntaxStateMachine_DDefineSsm.hpp>
#include <xo/reader2/ssm/IPrintable_DDefineSsm.hpp>
#include <xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp>
#include <xo/reader2/ssm/IPrintable_DExpectSymbolSsm.hpp>
@ -33,6 +34,7 @@ namespace xo {
FacetRegistry::register_impl<APrintable, DExprSeqState>();
FacetRegistry::register_impl<ASyntaxStateMachine, DDefineSsm>();
FacetRegistry::register_impl<APrintable, DDefineSsm>();
FacetRegistry::register_impl<ASyntaxStateMachine, DExpectSymbolSsm>();
FacetRegistry::register_impl<APrintable, DExpectSymbolSsm>();