xo-object2: APrintable+DFloat
This commit is contained in:
parent
a2e75071cc
commit
a903a058f1
9 changed files with 112 additions and 9 deletions
|
|
@ -37,11 +37,12 @@ xo_add_genfacetimpl(
|
|||
OUTPUT_CPP_DIR src/object2
|
||||
)
|
||||
|
||||
get_target_property(xo_printable2_src_dir xo-printable2 xo_srcdir)
|
||||
message(STATUS "xo_printable2_src_dir=${xo_printable_src_dir}")
|
||||
get_target_property(xo_printable2_dir share_xo_printable2 path)
|
||||
message(STATUS "xo_printable2_dir=${xo_printable2_dir}")
|
||||
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-object2-facetimpl-printable-float
|
||||
FACET_DIR ${xo_printable2_dir}
|
||||
FACET Printable
|
||||
REPR Float
|
||||
INPUT idl/IPrintable_DFloat.json5
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
#find_dependency(indentlog)
|
||||
find_dependency(xo_alloc2)
|
||||
find_dependency(xo_gc)
|
||||
find_dependency(xo_printable2)
|
||||
find_dependency(indentlog)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [],
|
||||
includes: [ "<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
|
||||
namespace1: "xo",
|
||||
namespace2: "print",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/Printable.json5",
|
||||
brief: "provide APrintable interface for DFloat",
|
||||
using_doxygen: true,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [],
|
||||
includes: [ "<xo/printable2/Printable.hpp>" ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/Sequence.json5",
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/indentlog/print/ppindentinfo.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
struct DFloat {
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
|
||||
explicit DFloat(double x) : value_{x} {}
|
||||
|
||||
|
|
@ -20,6 +22,8 @@ namespace xo {
|
|||
|
||||
double value() const noexcept { return value_; }
|
||||
|
||||
bool pretty(const ppindentinfo & ppii) const;
|
||||
|
||||
operator double() const noexcept { return value_; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
58
include/xo/object2/IPrintable_DFloat.hpp
Normal file
58
include/xo/object2/IPrintable_DFloat.hpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/** @file IPrintable_DFloat.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DFloat.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DFloat.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#include "DFloat.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IPrintable_DFloat; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::print::APrintable,
|
||||
xo::scm::DFloat>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DFloat,
|
||||
xo::scm::IPrintable_DFloat>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IPrintable_DFloat
|
||||
**/
|
||||
class IPrintable_DFloat {
|
||||
public:
|
||||
/** @defgroup scm-printable-dfloat-type-traits **/
|
||||
///@{
|
||||
using ppindentinfo = xo::print::APrintable::ppindentinfo;
|
||||
///@}
|
||||
/** @defgroup scm-printable-dfloat-methods **/
|
||||
///@{
|
||||
/** Pretty-printing support for this object.
|
||||
See [xo-indentlog/xo/indentlog/pretty.hpp]
|
||||
**/
|
||||
static bool pretty(const DFloat & self, const ppindentinfo & ppii);
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -7,12 +7,14 @@ set(SELF_SRCS
|
|||
IGCObject_DList.cpp
|
||||
ISequence_Any.cpp
|
||||
ISequence_DList.cpp
|
||||
IPrintable_DFloat.cpp
|
||||
DList.cpp
|
||||
DFloat.cpp
|
||||
object2_register_types.cpp
|
||||
)
|
||||
|
||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||
# note: deps here must also appear in cmake/xo_alloc2Config.cmake.in
|
||||
# note: deps here must also appear in cmake/xo_object2Config.cmake.in
|
||||
xo_dependency(${SELF_LIB} xo_gc)
|
||||
#xo_dependency(${SELF_LIB} indentlog)
|
||||
xo_dependency(${SELF_LIB} xo_printable2)
|
||||
xo_dependency(${SELF_LIB} indentlog)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
**/
|
||||
|
||||
#include "DFloat.hpp"
|
||||
#include <xo/indentlog/print/pretty.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::facet::typeseq;
|
||||
using xo::print::ppdetail_atomic;
|
||||
|
||||
namespace scm {
|
||||
DFloat *
|
||||
|
|
@ -18,6 +20,12 @@ namespace xo {
|
|||
|
||||
return new (mem) DFloat(x);
|
||||
}
|
||||
|
||||
bool
|
||||
DFloat::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppdetail_atomic<double>::print_pretty(ppii, value_);
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
28
src/object2/IPrintable_DFloat.cpp
Normal file
28
src/object2/IPrintable_DFloat.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DFloat.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DFloat.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DFloat.json5]
|
||||
**/
|
||||
|
||||
#include "IPrintable_DFloat.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DFloat::pretty(const DFloat & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DFloat.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue