diff options
author | rubenwardy <rubenwardy@gmail.com> | 2017-01-31 19:49:01 +0000 |
---|---|---|
committer | rubenwardy <rubenwardy@gmail.com> | 2017-02-04 22:07:55 +0000 |
commit | f2aa2c6a986dec47856c49ae5f54fbf3c688e027 (patch) | |
tree | d12fbb3e62776efaafe059a7fdbfa9938e7298cd /src/util/serialize.h | |
parent | c2e7b1f57941cb34cb7e3d71dc040fad53a64e3e (diff) | |
download | hax-minetest-server-f2aa2c6a986dec47856c49ae5f54fbf3c688e027.tar.gz hax-minetest-server-f2aa2c6a986dec47856c49ae5f54fbf3c688e027.zip |
Add ItemStack key-value meta storage
Diffstat (limited to '')
-rw-r--r-- | src/util/serialize.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/serialize.h b/src/util/serialize.h index 36324a675..e22434191 100644 --- a/src/util/serialize.h +++ b/src/util/serialize.h @@ -405,6 +405,13 @@ std::string serializeJsonString(const std::string &plain); // Reads a string encoded in JSON format std::string deSerializeJsonString(std::istream &is); +// If the string contains spaces, quotes or control characters, encodes as JSON. +// Else returns the string unmodified. +std::string serializeJsonStringIfNeeded(const std::string &s); + +// Parses a string serialized by serializeJsonStringIfNeeded. +std::string deSerializeJsonStringIfNeeded(std::istream &is); + // Creates a string consisting of the hexadecimal representation of `data` std::string serializeHexString(const std::string &data, bool insert_spaces=false); |