From 317a740f0198085937bf4fdbf032cc481d20f4ed Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 30 Aug 2017 14:31:28 -0700 Subject: Json now can take a UtfString as a text component. It immedaitely converts it to UTF-8 and stores it for now, but later on we may keep it longer, do some better validation, and have encoding options. --- src/unstable/json.cpp | 6 ++++++ src/unstable/json.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/unstable/json.cpp b/src/unstable/json.cpp index 5f6165c..6159ef3 100644 --- a/src/unstable/json.cpp +++ b/src/unstable/json.cpp @@ -13,6 +13,12 @@ Bu::Json::Json() : { } +Bu::Json::Json( const Bu::UtfString &sValue ) : + eType( String ), + uDat( sValue.get() ) +{ +} + Bu::Json::Json( const Bu::String &sValue ) : eType( String ), uDat( sValue ) diff --git a/src/unstable/json.h b/src/unstable/json.h index 7ac6f51..86074bc 100644 --- a/src/unstable/json.h +++ b/src/unstable/json.h @@ -4,6 +4,7 @@ #include "bu/hash.h" #include "bu/list.h" #include "bu/string.h" +#include "bu/utfstring.h" namespace Bu { @@ -32,6 +33,7 @@ namespace Bu public: Json(); + Json( const Bu::UtfString &sValue ); Json( const Bu::String &sValue ); Json( const char *sValue ); Json( double dValue ); -- cgit v1.2.3