From cac526a5170fa0c2356fc1978dfa41c87058d9d5 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 14 Sep 2024 12:09:06 -0500 Subject: [PATCH] xo-printjson: bugfix: adjust for upstream changes: xo::ref::rp -> xo::rp xo::quoted -> xo::quot new reflection metatype mt_function --- include/xo/printjson/PrintJson.hpp | 6 +++--- src/printjson/PrintJson.cpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/xo/printjson/PrintJson.hpp b/include/xo/printjson/PrintJson.hpp index c0ddcf55..8f463c27 100644 --- a/include/xo/printjson/PrintJson.hpp +++ b/include/xo/printjson/PrintJson.hpp @@ -41,7 +41,7 @@ namespace xo { /* convenience -- shorthand for * .print(obj->self_tp(), p_os) */ - void print_obj(ref::rp const & obj, std::ostream * p_os) const; + void print_obj(rp const & obj, std::ostream * p_os) const; void provide_printer(TypeId id, std::unique_ptr p) { *(printer_map_.require(id)) = std::move(p); @@ -74,13 +74,13 @@ namespace xo { */ class PrintJsonSingleton { public: - static ref::rp instance(); + static rp instance(); private: /* we don't need this to be stored as pointer. * memory burned if unused will be one empty std::vector<> */ - static ref::rp s_instance; + static rp s_instance; }; /*PrintJsonSingleton*/ } /*namespace json*/ diff --git a/src/printjson/PrintJson.cpp b/src/printjson/PrintJson.cpp index 7df2d5b3..3d5ae34b 100644 --- a/src/printjson/PrintJson.cpp +++ b/src/printjson/PrintJson.cpp @@ -17,9 +17,8 @@ namespace xo { using xo::reflect::TypeDescr; using xo::reflect::TaggedPtr; using xo::reflect::TaggedRcptr; - using xo::print::quoted; + using xo::print::quot; using xo::time::iso8601; - using xo::ref::rp; using xo::xtag; namespace json { @@ -153,6 +152,13 @@ namespace xo { case Metatype::mt_struct: print_generic_struct(*this, tp, p_os); return; + case Metatype::mt_function: + /** new branch (added for xo-expression / xo-jit) **/ + (*p_os) << "canonical_name()) + << xtag("metatype", tp.td()->metatype()) + << ">"; + return; case Metatype::mt_invalid: case Metatype::mt_atomic: break; @@ -340,7 +346,7 @@ namespace xo { if (x) { /* TODO: escapes special characters */ - *p_os << quoted(*x); + *p_os << quot(*x); } else { report_internal_type_consistency_error(Reflect::require(), tp.td(),