xo-expression2: + IExpression_DConstant
This commit is contained in:
parent
3cbbe5ab63
commit
9e9a76344c
6 changed files with 135 additions and 1 deletions
|
|
@ -32,6 +32,18 @@ xo_add_genfacet(
|
|||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-expression-constant
|
||||
FACET_PKG xo_expression2
|
||||
FACET Expression
|
||||
REPR Constant
|
||||
INPUT idl/IExpression_DConstant.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR detail
|
||||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# header-only library
|
||||
|
||||
|
|
|
|||
11
idl/IExpression_DConstant.json5
Normal file
11
idl/IExpression_DConstant.json5
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [ "\"Expression.hpp\"" ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/Expression.json5",
|
||||
brief: "provide AExpression interface for DConstant state",
|
||||
using_doxygen: true,
|
||||
repr: "DConstant",
|
||||
doc: ["doc for something or other IExpression+DConstant" ],
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@
|
|||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "TypeRef.hpp"
|
||||
#include "exprtype.hpp"
|
||||
#include <xo/reflect/TaggedPtr.hpp>
|
||||
|
|
|
|||
63
include/xo/expression2/IExpression_DConstant.hpp
Normal file
63
include/xo/expression2/IExpression_DConstant.hpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/** @file IExpression_DConstant.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IExpression_DConstant.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IExpression_DConstant.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Expression.hpp"
|
||||
#include "DConstant.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IExpression_DConstant; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::AExpression,
|
||||
xo::scm::DConstant>
|
||||
{
|
||||
using ImplType = xo::scm::IExpression_Xfer
|
||||
<xo::scm::DConstant,
|
||||
xo::scm::IExpression_DConstant>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IExpression_DConstant
|
||||
**/
|
||||
class IExpression_DConstant {
|
||||
public:
|
||||
/** @defgroup scm-expression-dconstant-type-traits **/
|
||||
///@{
|
||||
using TypeDescr = xo::scm::AExpression::TypeDescr;
|
||||
///@}
|
||||
/** @defgroup scm-expression-dconstant-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** expression type (constant | apply | ..) **/
|
||||
static exprtype extype(const DConstant & self) noexcept;
|
||||
/** placeholder for type giving possible values for this expression **/
|
||||
static TypeRef typeref(const DConstant & self) noexcept;
|
||||
/** type giving possible values for this expression. Maybe null before typecheck **/
|
||||
static TypeDescr valuetype(const DConstant & self) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** assing to valuetype member. Useful when scaffolding expressions **/
|
||||
static void assign_valuetype(DConstant & self, TypeDescr td) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -4,7 +4,8 @@ set(SELF_LIB xo_expression2)
|
|||
set(SELF_SRCS
|
||||
DConstant.cpp
|
||||
TypeRef.cpp
|
||||
#IExpression_Any.cpp
|
||||
IExpression_Any.cpp
|
||||
IExpression_DConstant.cpp
|
||||
expression2_register_facets.cpp
|
||||
)
|
||||
|
||||
|
|
|
|||
45
src/expression2/IExpression_DConstant.cpp
Normal file
45
src/expression2/IExpression_DConstant.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/** @file IExpression_DConstant.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IExpression_DConstant.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IExpression_DConstant.json5]
|
||||
**/
|
||||
|
||||
#include "IExpression_DConstant.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IExpression_DConstant::extype(const DConstant & self) noexcept -> exprtype
|
||||
{
|
||||
return self.extype();
|
||||
}
|
||||
|
||||
auto
|
||||
IExpression_DConstant::typeref(const DConstant & self) noexcept -> TypeRef
|
||||
{
|
||||
return self.typeref();
|
||||
}
|
||||
|
||||
auto
|
||||
IExpression_DConstant::valuetype(const DConstant & self) noexcept -> TypeDescr
|
||||
{
|
||||
return self.valuetype();
|
||||
}
|
||||
|
||||
auto
|
||||
IExpression_DConstant::assign_valuetype(DConstant & self, TypeDescr td) noexcept -> void
|
||||
{
|
||||
self.assign_valuetype(td);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IExpression_DConstant.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue