xo-printjson: bugfix: adjust for upstream changes:
xo::ref::rp -> xo::rp xo::quoted -> xo::quot new reflection metatype mt_function
This commit is contained in:
parent
ea8faf7032
commit
cac526a517
2 changed files with 12 additions and 6 deletions
|
|
@ -41,7 +41,7 @@ namespace xo {
|
||||||
/* convenience -- shorthand for
|
/* convenience -- shorthand for
|
||||||
* .print(obj->self_tp(), p_os)
|
* .print(obj->self_tp(), p_os)
|
||||||
*/
|
*/
|
||||||
void print_obj(ref::rp<SelfTagging> const & obj, std::ostream * p_os) const;
|
void print_obj(rp<SelfTagging> const & obj, std::ostream * p_os) const;
|
||||||
|
|
||||||
void provide_printer(TypeId id, std::unique_ptr<JsonPrinter> p) {
|
void provide_printer(TypeId id, std::unique_ptr<JsonPrinter> p) {
|
||||||
*(printer_map_.require(id)) = std::move(p);
|
*(printer_map_.require(id)) = std::move(p);
|
||||||
|
|
@ -74,13 +74,13 @@ namespace xo {
|
||||||
*/
|
*/
|
||||||
class PrintJsonSingleton {
|
class PrintJsonSingleton {
|
||||||
public:
|
public:
|
||||||
static ref::rp<PrintJson> instance();
|
static rp<PrintJson> instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* we don't need this to be stored as pointer.
|
/* we don't need this to be stored as pointer.
|
||||||
* memory burned if unused will be one empty std::vector<>
|
* memory burned if unused will be one empty std::vector<>
|
||||||
*/
|
*/
|
||||||
static ref::rp<PrintJson> s_instance;
|
static rp<PrintJson> s_instance;
|
||||||
}; /*PrintJsonSingleton*/
|
}; /*PrintJsonSingleton*/
|
||||||
|
|
||||||
} /*namespace json*/
|
} /*namespace json*/
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ namespace xo {
|
||||||
using xo::reflect::TypeDescr;
|
using xo::reflect::TypeDescr;
|
||||||
using xo::reflect::TaggedPtr;
|
using xo::reflect::TaggedPtr;
|
||||||
using xo::reflect::TaggedRcptr;
|
using xo::reflect::TaggedRcptr;
|
||||||
using xo::print::quoted;
|
using xo::print::quot;
|
||||||
using xo::time::iso8601;
|
using xo::time::iso8601;
|
||||||
using xo::ref::rp;
|
|
||||||
using xo::xtag;
|
using xo::xtag;
|
||||||
|
|
||||||
namespace json {
|
namespace json {
|
||||||
|
|
@ -153,6 +152,13 @@ namespace xo {
|
||||||
case Metatype::mt_struct:
|
case Metatype::mt_struct:
|
||||||
print_generic_struct(*this, tp, p_os);
|
print_generic_struct(*this, tp, p_os);
|
||||||
return;
|
return;
|
||||||
|
case Metatype::mt_function:
|
||||||
|
/** new branch (added for xo-expression / xo-jit) **/
|
||||||
|
(*p_os) << "<error-json-printer-not-implemented"
|
||||||
|
<< xtag("type", tp.td()->canonical_name())
|
||||||
|
<< xtag("metatype", tp.td()->metatype())
|
||||||
|
<< ">";
|
||||||
|
return;
|
||||||
case Metatype::mt_invalid:
|
case Metatype::mt_invalid:
|
||||||
case Metatype::mt_atomic:
|
case Metatype::mt_atomic:
|
||||||
break;
|
break;
|
||||||
|
|
@ -340,7 +346,7 @@ namespace xo {
|
||||||
|
|
||||||
if (x) {
|
if (x) {
|
||||||
/* TODO: escapes special characters */
|
/* TODO: escapes special characters */
|
||||||
*p_os << quoted(*x);
|
*p_os << quot(*x);
|
||||||
} else {
|
} else {
|
||||||
report_internal_type_consistency_error(Reflect::require<T>(),
|
report_internal_type_consistency_error(Reflect::require<T>(),
|
||||||
tp.td(),
|
tp.td(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue