diff options
| author | Mike Buland <mbuland@penny-arcade.com> | 2017-08-30 14:31:28 -0700 |
|---|---|---|
| committer | Mike Buland <mbuland@penny-arcade.com> | 2017-08-30 14:31:28 -0700 |
| commit | 317a740f0198085937bf4fdbf032cc481d20f4ed (patch) | |
| tree | fb3eb538f1c75801d163870ccc2acc724e95f4a5 | |
| parent | d5ff686220bde38bf7d1da55779a1bda9b771d53 (diff) | |
| download | libbu++-317a740f0198085937bf4fdbf032cc481d20f4ed.tar.gz libbu++-317a740f0198085937bf4fdbf032cc481d20f4ed.tar.bz2 libbu++-317a740f0198085937bf4fdbf032cc481d20f4ed.tar.xz libbu++-317a740f0198085937bf4fdbf032cc481d20f4ed.zip | |
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.
Diffstat (limited to '')
| -rw-r--r-- | src/unstable/json.cpp | 6 | ||||
| -rw-r--r-- | src/unstable/json.h | 2 |
2 files changed, 8 insertions, 0 deletions
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() : | |||
| 13 | { | 13 | { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | Bu::Json::Json( const Bu::UtfString &sValue ) : | ||
| 17 | eType( String ), | ||
| 18 | uDat( sValue.get() ) | ||
| 19 | { | ||
| 20 | } | ||
| 21 | |||
| 16 | Bu::Json::Json( const Bu::String &sValue ) : | 22 | Bu::Json::Json( const Bu::String &sValue ) : |
| 17 | eType( String ), | 23 | eType( String ), |
| 18 | uDat( sValue ) | 24 | 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 @@ | |||
| 4 | #include "bu/hash.h" | 4 | #include "bu/hash.h" |
| 5 | #include "bu/list.h" | 5 | #include "bu/list.h" |
| 6 | #include "bu/string.h" | 6 | #include "bu/string.h" |
| 7 | #include "bu/utfstring.h" | ||
| 7 | 8 | ||
| 8 | namespace Bu | 9 | namespace Bu |
| 9 | { | 10 | { |
| @@ -32,6 +33,7 @@ namespace Bu | |||
| 32 | 33 | ||
| 33 | public: | 34 | public: |
| 34 | Json(); | 35 | Json(); |
| 36 | Json( const Bu::UtfString &sValue ); | ||
| 35 | Json( const Bu::String &sValue ); | 37 | Json( const Bu::String &sValue ); |
| 36 | Json( const char *sValue ); | 38 | Json( const char *sValue ); |
| 37 | Json( double dValue ); | 39 | Json( double dValue ); |
