mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Jsonize documentation
git-svn-id: svn://ultimatepp.org/upp/trunk@5425 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5b78bf89ad
commit
beb8c8eda0
3 changed files with 546 additions and 361 deletions
|
|
@ -1,360 +1,361 @@
|
|||
Value ParseJSON(CParser& p);
|
||||
Value ParseJSON(const char *s);
|
||||
|
||||
inline String AsJSON(int i) { return IsNull(i) ? "null" : AsString(i); }
|
||||
inline String AsJSON(double n) { return IsNull(n) ? "null" : AsString(n); }
|
||||
inline String AsJSON(bool b) { return b ? "true" : "false"; }
|
||||
inline String AsJSON(const String& s) { return AsCString(s, INT_MAX, NULL, ASCSTRING_JSON); }
|
||||
inline String AsJSON(const WString& s) { return AsCString(s.ToString(), INT_MAX, NULL, ASCSTRING_JSON); }
|
||||
inline String AsJSON(const char *s) { return AsCString(s, INT_MAX, NULL, ASCSTRING_JSON); }
|
||||
|
||||
String AsJSON(const Value& v, const String& indent, bool pretty);
|
||||
String AsJSON(const Value& v, bool pretty = false);
|
||||
|
||||
class JsonArray;
|
||||
|
||||
class Json {
|
||||
String text;
|
||||
|
||||
public:
|
||||
Json& CatRaw(const char *key, const String& val);
|
||||
|
||||
String ToString() const { return "{" + text + "}"; }
|
||||
String operator~() const { return ToString(); }
|
||||
operator String() const { return ToString(); }
|
||||
|
||||
operator bool() const { return text.GetCount(); }
|
||||
|
||||
Json& operator()(const char *key, const Value& value) { return CatRaw(key, AsJSON(value)); }
|
||||
Json& operator()(const char *key, int i) { return CatRaw(key, AsJSON(i)); }
|
||||
Json& operator()(const char *key, double n) { return CatRaw(key, AsJSON(n)); }
|
||||
Json& operator()(const char *key, bool b) { return CatRaw(key, AsJSON(b)); }
|
||||
Json& operator()(const char *key, const String& s) { return CatRaw(key, AsJSON(s)); }
|
||||
Json& operator()(const char *key, const WString& s) { return CatRaw(key, AsJSON(s)); }
|
||||
Json& operator()(const char *key, const char *s) { return CatRaw(key, AsJSON(s)); }
|
||||
Json& operator()(const char *key, const Json& object) { return CatRaw(key, ~object); }
|
||||
Json& operator()(const char *key, const JsonArray& array);
|
||||
|
||||
Json() {}
|
||||
Json(const char *key, const Value& value) { CatRaw(key, AsJSON(value)); }
|
||||
Json(const char *key, int i) { CatRaw(key, AsJSON(i)); }
|
||||
Json(const char *key, double n) { CatRaw(key, AsJSON(n)); }
|
||||
Json(const char *key, bool b) { CatRaw(key, AsJSON(b)); }
|
||||
Json(const char *key, const String& s) { CatRaw(key, AsJSON(s)); }
|
||||
Json(const char *key, const WString& s) { CatRaw(key, AsJSON(s)); }
|
||||
Json(const char *key, const char *s) { CatRaw(key, AsJSON(s)); }
|
||||
Json(const char *key, const Json& object) { CatRaw(key, ~object); }
|
||||
Json(const char *key, const JsonArray& array) { operator()(key, array); }
|
||||
};
|
||||
|
||||
class JsonArray {
|
||||
String text;
|
||||
|
||||
public:
|
||||
JsonArray& CatRaw(const String& val);
|
||||
|
||||
String ToString() const { return "[" + text + "]"; }
|
||||
String operator~() const { return ToString(); }
|
||||
operator String() const { return ToString(); }
|
||||
|
||||
operator bool() const { return text.GetCount(); }
|
||||
|
||||
JsonArray& operator<<(const Value& value) { return CatRaw(AsJSON(value)); }
|
||||
JsonArray& operator<<(int i) { return CatRaw(AsJSON(i)); }
|
||||
JsonArray& operator<<(double n) { return CatRaw(AsJSON(n)); }
|
||||
JsonArray& operator<<(bool b) { return CatRaw(AsJSON(b)); }
|
||||
JsonArray& operator<<(const String& s) { return CatRaw(AsJSON(s)); }
|
||||
JsonArray& operator<<(const WString& s) { return CatRaw(AsJSON(s)); }
|
||||
JsonArray& operator<<(const char *s) { return CatRaw(AsJSON(s)); }
|
||||
JsonArray& operator<<(const Json& object) { return CatRaw(~object); }
|
||||
JsonArray& operator<<(const JsonArray& array) { return CatRaw(~array); }
|
||||
|
||||
JsonArray() {}
|
||||
};
|
||||
|
||||
inline Json& Json::operator()(const char *key, const JsonArray& array)
|
||||
{
|
||||
return CatRaw(key, array);
|
||||
}
|
||||
|
||||
class JsonIO {
|
||||
const Value *src;
|
||||
One<ValueMap> map;
|
||||
Value tgt;
|
||||
|
||||
public:
|
||||
bool IsLoading() const { return src; }
|
||||
bool IsStoring() const { return !src; }
|
||||
|
||||
const Value& Get() const { ASSERT(IsLoading()); return *src; }
|
||||
void Set(const Value& v) { ASSERT(IsStoring() && !map); tgt = v; }
|
||||
void Put(Value& v) { ASSERT(IsStoring()); if(map) v = *map; else v = tgt; }
|
||||
Value GetResult() const { ASSERT(IsStoring()); return map ? Value(*map) : tgt; }
|
||||
|
||||
template <class T>
|
||||
JsonIO& operator()(const char *key, T& value);
|
||||
|
||||
JsonIO(const Value& src) : src(&src) {}
|
||||
JsonIO() { src = NULL; }
|
||||
};
|
||||
|
||||
struct JsonizeError : Exc {
|
||||
JsonizeError(const String& s) : Exc(s) {}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, T& var)
|
||||
{
|
||||
var.Jsonize(io);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
JsonIO& JsonIO::operator()(const char *key, T& value)
|
||||
{
|
||||
if(IsLoading()) {
|
||||
const Value& v = (*src)[key];
|
||||
if(!v.IsVoid()) {
|
||||
JsonIO jio(v);
|
||||
Jsonize(jio, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ASSERT(tgt.IsVoid());
|
||||
if(!map)
|
||||
map.Create();
|
||||
JsonIO jio;
|
||||
Jsonize(jio, value);
|
||||
if(jio.map)
|
||||
map->Add(key, *jio.map);
|
||||
else
|
||||
map->Add(key, jio.tgt);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Value StoreAsJsonValue(const T& var)
|
||||
{
|
||||
JsonIO io;
|
||||
Jsonize(io, const_cast<T&>(var));
|
||||
return io.GetResult();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void LoadFromJsonValue(T& var, const Value& x)
|
||||
{
|
||||
JsonIO io(x);
|
||||
Jsonize(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
String StoreAsJson(const T& var, bool pretty = false)
|
||||
{
|
||||
return AsJSON(StoreAsJsonValue(var), pretty);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool LoadFromJson(T& var, const char *json)
|
||||
{
|
||||
try {
|
||||
Value jv = ParseJSON(json);
|
||||
if(jv.IsError())
|
||||
return false;
|
||||
LoadFromJsonValue(var, jv);
|
||||
}
|
||||
catch(JsonizeError) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String sJsonFile(const char *file);
|
||||
|
||||
template <class T>
|
||||
bool StoreAsJsonFile(const T& var, const char *file, bool pretty = false)
|
||||
{
|
||||
return SaveFile(sJsonFile(file), StoreAsJson(var, pretty));;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool LoadFromJsonFile(T& var, const char *file = NULL)
|
||||
{
|
||||
return LoadFromJson(var, LoadFile(sJsonFile(file)));
|
||||
}
|
||||
|
||||
template<> void Jsonize(JsonIO& io, int& var);
|
||||
template<> void Jsonize(JsonIO& io, int16& var);
|
||||
template<> void Jsonize(JsonIO& io, int64& var);
|
||||
template<> void Jsonize(JsonIO& io, double& var);
|
||||
template<> void Jsonize(JsonIO& io, bool& var);
|
||||
template<> void Jsonize(JsonIO& io, String& var);
|
||||
template<> void Jsonize(JsonIO& io, WString& var);
|
||||
template<> void Jsonize(JsonIO& io, Date& var);
|
||||
template<> void Jsonize(JsonIO& io, Time& var);
|
||||
|
||||
template <class T, class V>
|
||||
void JsonizeArray(JsonIO& io, T& array)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
const Value& va = io.Get();
|
||||
array.SetCount(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
JsonIO jio(va[i]);
|
||||
Jsonize(jio, array[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Vector<Value> va;
|
||||
va.SetCount(array.GetCount());
|
||||
for(int i = 0; i < array.GetCount(); i++) {
|
||||
JsonIO jio;
|
||||
Jsonize(jio, array[i]);
|
||||
jio.Put(va[i]);
|
||||
}
|
||||
io.Set(ValueArray(va));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, Vector<T>& var)
|
||||
{
|
||||
JsonizeArray<Vector<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, Array<T>& var)
|
||||
{
|
||||
JsonizeArray<Array<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T, class K, class V>
|
||||
void JsonizeMap(JsonIO& io, T& map, const char *keyid, const char *valueid)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
map.Clear();
|
||||
const Value& va = io.Get();
|
||||
map.Reserve(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
K key;
|
||||
V value;
|
||||
LoadFromJsonValue(key, va[i][keyid]);
|
||||
LoadFromJsonValue(value, va[i][valueid]);
|
||||
map.Add(key, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Vector<Value> va;
|
||||
va.SetCount(map.GetCount());
|
||||
for(int i = 0; i < map.GetCount(); i++)
|
||||
if(!map.IsUnlinked(i)) {
|
||||
ValueMap item;
|
||||
item.Add(keyid, StoreAsJsonValue(map.GetKey(i)));
|
||||
item.Add(valueid, StoreAsJsonValue(map[i]));
|
||||
va[i] = item;
|
||||
}
|
||||
io.Set(ValueArray(va));
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void Jsonize(JsonIO& io, VectorMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeMap<VectorMap<K, V, H>, K, V>(io, map, "key", "value");
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void Jsonize(JsonIO& io, ArrayMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeMap<ArrayMap<K, V, H>, K, V>(io, map, "key", "value");
|
||||
}
|
||||
|
||||
template <class T, class K, class V>
|
||||
void JsonizeStringMap(JsonIO& io, T& map)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
map.Clear();
|
||||
const ValueMap& va = io.Get();
|
||||
map.Reserve(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
V value;
|
||||
String key = va.GetKey(i);
|
||||
LoadFromJsonValue(key, va.GetKey(i));
|
||||
LoadFromJsonValue(value, va.GetValue(i));
|
||||
map.Add(key, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Index<Value> index;
|
||||
Vector<Value> values;
|
||||
index.Reserve(map.GetCount());
|
||||
values.Reserve(map.GetCount());
|
||||
for (int i=0; i<map.GetCount(); ++i)
|
||||
{
|
||||
index.Add(StoreAsJsonValue(map.GetKey(i)));
|
||||
values.Add(StoreAsJsonValue(map[i]));
|
||||
}
|
||||
ValueMap vm(index, values);
|
||||
io.Set(vm);
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void StringMap(JsonIO& io, VectorMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeStringMap<VectorMap<K, V, H>, K, V>(io, map);
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void StringMap(JsonIO& io, ArrayMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeStringMap<ArrayMap<K, V, H>, K, V>(io, map);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
void JsonizeIndex(JsonIO& io, T& index)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
const Value& va = io.Get();
|
||||
index.Reserve(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
V v;
|
||||
LoadFromJsonValue(v, va[i]);
|
||||
index.Add(v);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Vector<Value> va;
|
||||
for(int i = 0; i < index.GetCount(); i++)
|
||||
if(!index.IsUnlinked(i))
|
||||
va.Add(StoreAsJsonValue(index[i]));
|
||||
io.Set(ValueArray(va));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, Index<T>& var)
|
||||
{
|
||||
JsonizeIndex<Index<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, ArrayIndex<T>& var)
|
||||
{
|
||||
JsonizeIndex<ArrayIndex<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void JsonizeBySerialize(JsonIO& jio, T& x)
|
||||
{
|
||||
String h;
|
||||
if(jio.IsStoring())
|
||||
h = HexString(StoreAsString(x));
|
||||
jio("data", h);
|
||||
if(jio.IsLoading())
|
||||
try {
|
||||
LoadFromString(x, ScanHexString(h));
|
||||
}
|
||||
catch(LoadingError) {
|
||||
throw JsonizeError("jsonize by serialize error");
|
||||
}
|
||||
}
|
||||
Value ParseJSON(CParser& p);
|
||||
Value ParseJSON(const char *s);
|
||||
|
||||
inline String AsJSON(int i) { return IsNull(i) ? "null" : AsString(i); }
|
||||
inline String AsJSON(double n) { return IsNull(n) ? "null" : AsString(n); }
|
||||
inline String AsJSON(bool b) { return b ? "true" : "false"; }
|
||||
inline String AsJSON(const String& s) { return AsCString(s, INT_MAX, NULL, ASCSTRING_JSON); }
|
||||
inline String AsJSON(const WString& s) { return AsCString(s.ToString(), INT_MAX, NULL, ASCSTRING_JSON); }
|
||||
inline String AsJSON(const char *s) { return AsCString(s, INT_MAX, NULL, ASCSTRING_JSON); }
|
||||
|
||||
String AsJSON(const Value& v, const String& indent, bool pretty);
|
||||
String AsJSON(const Value& v, bool pretty = false);
|
||||
|
||||
class JsonArray;
|
||||
|
||||
class Json {
|
||||
String text;
|
||||
|
||||
public:
|
||||
Json& CatRaw(const char *key, const String& val);
|
||||
|
||||
String ToString() const { return "{" + text + "}"; }
|
||||
String operator~() const { return ToString(); }
|
||||
operator String() const { return ToString(); }
|
||||
|
||||
operator bool() const { return text.GetCount(); }
|
||||
|
||||
Json& operator()(const char *key, const Value& value) { return CatRaw(key, AsJSON(value)); }
|
||||
Json& operator()(const char *key, int i) { return CatRaw(key, AsJSON(i)); }
|
||||
Json& operator()(const char *key, double n) { return CatRaw(key, AsJSON(n)); }
|
||||
Json& operator()(const char *key, bool b) { return CatRaw(key, AsJSON(b)); }
|
||||
Json& operator()(const char *key, const String& s) { return CatRaw(key, AsJSON(s)); }
|
||||
Json& operator()(const char *key, const WString& s) { return CatRaw(key, AsJSON(s)); }
|
||||
Json& operator()(const char *key, const char *s) { return CatRaw(key, AsJSON(s)); }
|
||||
Json& operator()(const char *key, const Json& object) { return CatRaw(key, ~object); }
|
||||
Json& operator()(const char *key, const JsonArray& array);
|
||||
|
||||
Json() {}
|
||||
Json(const char *key, const Value& value) { CatRaw(key, AsJSON(value)); }
|
||||
Json(const char *key, int i) { CatRaw(key, AsJSON(i)); }
|
||||
Json(const char *key, double n) { CatRaw(key, AsJSON(n)); }
|
||||
Json(const char *key, bool b) { CatRaw(key, AsJSON(b)); }
|
||||
Json(const char *key, const String& s) { CatRaw(key, AsJSON(s)); }
|
||||
Json(const char *key, const WString& s) { CatRaw(key, AsJSON(s)); }
|
||||
Json(const char *key, const char *s) { CatRaw(key, AsJSON(s)); }
|
||||
Json(const char *key, const Json& object) { CatRaw(key, ~object); }
|
||||
Json(const char *key, const JsonArray& array) { operator()(key, array); }
|
||||
};
|
||||
|
||||
class JsonArray {
|
||||
String text;
|
||||
|
||||
public:
|
||||
JsonArray& CatRaw(const String& val);
|
||||
|
||||
String ToString() const { return "[" + text + "]"; }
|
||||
String operator~() const { return ToString(); }
|
||||
operator String() const { return ToString(); }
|
||||
|
||||
operator bool() const { return text.GetCount(); }
|
||||
|
||||
JsonArray& operator<<(const Value& value) { return CatRaw(AsJSON(value)); }
|
||||
JsonArray& operator<<(int i) { return CatRaw(AsJSON(i)); }
|
||||
JsonArray& operator<<(double n) { return CatRaw(AsJSON(n)); }
|
||||
JsonArray& operator<<(bool b) { return CatRaw(AsJSON(b)); }
|
||||
JsonArray& operator<<(const String& s) { return CatRaw(AsJSON(s)); }
|
||||
JsonArray& operator<<(const WString& s) { return CatRaw(AsJSON(s)); }
|
||||
JsonArray& operator<<(const char *s) { return CatRaw(AsJSON(s)); }
|
||||
JsonArray& operator<<(const Json& object) { return CatRaw(~object); }
|
||||
JsonArray& operator<<(const JsonArray& array) { return CatRaw(~array); }
|
||||
|
||||
JsonArray() {}
|
||||
};
|
||||
|
||||
inline Json& Json::operator()(const char *key, const JsonArray& array)
|
||||
{
|
||||
return CatRaw(key, array);
|
||||
}
|
||||
|
||||
class JsonIO {
|
||||
const Value *src;
|
||||
One<ValueMap> map;
|
||||
Value tgt;
|
||||
|
||||
public:
|
||||
bool IsLoading() const { return src; }
|
||||
bool IsStoring() const { return !src; }
|
||||
|
||||
const Value& Get() const { ASSERT(IsLoading()); return *src; }
|
||||
void Set(const Value& v) { ASSERT(IsStoring() && !map); tgt = v; }
|
||||
|
||||
void Put(Value& v) { ASSERT(IsStoring()); if(map) v = *map; else v = tgt; }
|
||||
Value GetResult() const { ASSERT(IsStoring()); return map ? Value(*map) : tgt; }
|
||||
|
||||
template <class T>
|
||||
JsonIO& operator()(const char *key, T& value);
|
||||
|
||||
JsonIO(const Value& src) : src(&src) {}
|
||||
JsonIO() { src = NULL; }
|
||||
};
|
||||
|
||||
struct JsonizeError : Exc {
|
||||
JsonizeError(const String& s) : Exc(s) {}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, T& var)
|
||||
{
|
||||
var.Jsonize(io);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
JsonIO& JsonIO::operator()(const char *key, T& value)
|
||||
{
|
||||
if(IsLoading()) {
|
||||
const Value& v = (*src)[key];
|
||||
if(!v.IsVoid()) {
|
||||
JsonIO jio(v);
|
||||
Jsonize(jio, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ASSERT(tgt.IsVoid());
|
||||
if(!map)
|
||||
map.Create();
|
||||
JsonIO jio;
|
||||
Jsonize(jio, value);
|
||||
if(jio.map)
|
||||
map->Add(key, *jio.map);
|
||||
else
|
||||
map->Add(key, jio.tgt);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Value StoreAsJsonValue(const T& var)
|
||||
{
|
||||
JsonIO io;
|
||||
Jsonize(io, const_cast<T&>(var));
|
||||
return io.GetResult();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void LoadFromJsonValue(T& var, const Value& x)
|
||||
{
|
||||
JsonIO io(x);
|
||||
Jsonize(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
String StoreAsJson(const T& var, bool pretty = false)
|
||||
{
|
||||
return AsJSON(StoreAsJsonValue(var), pretty);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool LoadFromJson(T& var, const char *json)
|
||||
{
|
||||
try {
|
||||
Value jv = ParseJSON(json);
|
||||
if(jv.IsError())
|
||||
return false;
|
||||
LoadFromJsonValue(var, jv);
|
||||
}
|
||||
catch(JsonizeError) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String sJsonFile(const char *file);
|
||||
|
||||
template <class T>
|
||||
bool StoreAsJsonFile(const T& var, const char *file, bool pretty = false)
|
||||
{
|
||||
return SaveFile(sJsonFile(file), StoreAsJson(var, pretty));;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool LoadFromJsonFile(T& var, const char *file = NULL)
|
||||
{
|
||||
return LoadFromJson(var, LoadFile(sJsonFile(file)));
|
||||
}
|
||||
|
||||
template<> void Jsonize(JsonIO& io, int& var);
|
||||
template<> void Jsonize(JsonIO& io, int16& var);
|
||||
template<> void Jsonize(JsonIO& io, int64& var);
|
||||
template<> void Jsonize(JsonIO& io, double& var);
|
||||
template<> void Jsonize(JsonIO& io, bool& var);
|
||||
template<> void Jsonize(JsonIO& io, String& var);
|
||||
template<> void Jsonize(JsonIO& io, WString& var);
|
||||
template<> void Jsonize(JsonIO& io, Date& var);
|
||||
template<> void Jsonize(JsonIO& io, Time& var);
|
||||
|
||||
template <class T, class V>
|
||||
void JsonizeArray(JsonIO& io, T& array)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
const Value& va = io.Get();
|
||||
array.SetCount(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
JsonIO jio(va[i]);
|
||||
Jsonize(jio, array[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Vector<Value> va;
|
||||
va.SetCount(array.GetCount());
|
||||
for(int i = 0; i < array.GetCount(); i++) {
|
||||
JsonIO jio;
|
||||
Jsonize(jio, array[i]);
|
||||
jio.Put(va[i]);
|
||||
}
|
||||
io.Set(ValueArray(va));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, Vector<T>& var)
|
||||
{
|
||||
JsonizeArray<Vector<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, Array<T>& var)
|
||||
{
|
||||
JsonizeArray<Array<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T, class K, class V>
|
||||
void JsonizeMap(JsonIO& io, T& map, const char *keyid, const char *valueid)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
map.Clear();
|
||||
const Value& va = io.Get();
|
||||
map.Reserve(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
K key;
|
||||
V value;
|
||||
LoadFromJsonValue(key, va[i][keyid]);
|
||||
LoadFromJsonValue(value, va[i][valueid]);
|
||||
map.Add(key, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Vector<Value> va;
|
||||
va.SetCount(map.GetCount());
|
||||
for(int i = 0; i < map.GetCount(); i++)
|
||||
if(!map.IsUnlinked(i)) {
|
||||
ValueMap item;
|
||||
item.Add(keyid, StoreAsJsonValue(map.GetKey(i)));
|
||||
item.Add(valueid, StoreAsJsonValue(map[i]));
|
||||
va[i] = item;
|
||||
}
|
||||
io.Set(ValueArray(va));
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void Jsonize(JsonIO& io, VectorMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeMap<VectorMap<K, V, H>, K, V>(io, map, "key", "value");
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void Jsonize(JsonIO& io, ArrayMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeMap<ArrayMap<K, V, H>, K, V>(io, map, "key", "value");
|
||||
}
|
||||
|
||||
template <class T, class K, class V>
|
||||
void JsonizeStringMap(JsonIO& io, T& map)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
map.Clear();
|
||||
const ValueMap& va = io.Get();
|
||||
map.Reserve(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
V value;
|
||||
String key = va.GetKey(i);
|
||||
LoadFromJsonValue(key, va.GetKey(i));
|
||||
LoadFromJsonValue(value, va.GetValue(i));
|
||||
map.Add(key, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Index<Value> index;
|
||||
Vector<Value> values;
|
||||
index.Reserve(map.GetCount());
|
||||
values.Reserve(map.GetCount());
|
||||
for (int i=0; i<map.GetCount(); ++i)
|
||||
{
|
||||
index.Add(StoreAsJsonValue(map.GetKey(i)));
|
||||
values.Add(StoreAsJsonValue(map[i]));
|
||||
}
|
||||
ValueMap vm(index, values);
|
||||
io.Set(vm);
|
||||
}
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void StringMap(JsonIO& io, VectorMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeStringMap<VectorMap<K, V, H>, K, V>(io, map);
|
||||
}
|
||||
|
||||
template <class K, class V, class H>
|
||||
void StringMap(JsonIO& io, ArrayMap<K, V, H>& map)
|
||||
{
|
||||
JsonizeStringMap<ArrayMap<K, V, H>, K, V>(io, map);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
void JsonizeIndex(JsonIO& io, T& index)
|
||||
{
|
||||
if(io.IsLoading()) {
|
||||
const Value& va = io.Get();
|
||||
index.Reserve(va.GetCount());
|
||||
for(int i = 0; i < va.GetCount(); i++) {
|
||||
V v;
|
||||
LoadFromJsonValue(v, va[i]);
|
||||
index.Add(v);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Vector<Value> va;
|
||||
for(int i = 0; i < index.GetCount(); i++)
|
||||
if(!index.IsUnlinked(i))
|
||||
va.Add(StoreAsJsonValue(index[i]));
|
||||
io.Set(ValueArray(va));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, Index<T>& var)
|
||||
{
|
||||
JsonizeIndex<Index<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Jsonize(JsonIO& io, ArrayIndex<T>& var)
|
||||
{
|
||||
JsonizeIndex<ArrayIndex<T>, T>(io, var);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void JsonizeBySerialize(JsonIO& jio, T& x)
|
||||
{
|
||||
String h;
|
||||
if(jio.IsStoring())
|
||||
h = HexString(StoreAsString(x));
|
||||
jio("data", h);
|
||||
if(jio.IsLoading())
|
||||
try {
|
||||
LoadFromString(x, ScanHexString(h));
|
||||
}
|
||||
catch(LoadingError) {
|
||||
throw JsonizeError("jsonize by serialize error");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ onst]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v], [@(0.0.255) const]_[_^String^ Str
|
|||
ValueArray as JSON array. [%-*@3 indent] is prepended to each line.
|
||||
If [%-*@3 pretty] is true, JSON is encoded in lines, indenting
|
||||
each level of embedding, if it is false, JSON is as compact as
|
||||
possible..&]
|
||||
possible.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:AsJSON`(const Value`&`,bool`): [_^String^ String]_[* AsJSON]([@(0.0.255) const]_[_^Value^ V
|
||||
|
|
|
|||
184
uppsrc/Core/src.tpp/Jsonize$en-us.tpp
Normal file
184
uppsrc/Core/src.tpp/Jsonize$en-us.tpp
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
topic "JsonIO and Jsonize framework";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
[H6;0 $$4,0#05600065144404261032431302351956:begin]
|
||||
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item]
|
||||
[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement]
|
||||
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
|
||||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[{_}
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 JsonIO and Jsonize framework]]}}&]
|
||||
[s3; &]
|
||||
[s1;:JsonIO`:`:class: [@(0.0.255)3 class][3 _][*3 JsonIO]&]
|
||||
[s2;%% JsonIO represents a single JSON value in Jsonize framework.
|
||||
It is used as parameter for Jsonize global function. Jsonize
|
||||
global function has default templated definition that in turn
|
||||
calls Jsonize method of object. However, when implementation
|
||||
using method is not possible (e.g. for supported primitive types),
|
||||
global templated specialization of Jsonize can be used.&]
|
||||
[s3; &]
|
||||
[ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&]
|
||||
[s3;%% &]
|
||||
[s5;:JsonIO`:`:IsLoading`(`)const: [@(0.0.255) bool]_[* IsLoading]()_[@(0.0.255) const]&]
|
||||
[s2;%% Returns true when retrieving data from JSON.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:JsonIO`:`:IsStoring`(`)const: [@(0.0.255) bool]_[* IsStoring]()_[@(0.0.255) const]&]
|
||||
[s2;%% Returns true when storing data to JSON.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:JsonIO`:`:Get`(`)const: [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[* Get]()_[@(0.0.255) c
|
||||
onst]&]
|
||||
[s2;%% Returns the value of JSON node when loading.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:JsonIO`:`:Set`(const Value`&`): [@(0.0.255) void]_[* Set]([@(0.0.255) const]_[_^Value^ V
|
||||
alue][@(0.0.255) `&]_[*@3 v])&]
|
||||
[s2;%% Sets the value of JSON node when storing.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:JsonIO`:`:Put`(Value`&`): [@(0.0.255) void]_[* Put]([_^Value^ Value][@(0.0.255) `&]_[*@3 v
|
||||
])&]
|
||||
[s2;%% Retrieves JSON node data into [%-*@3 v] when storing `- invoked
|
||||
to finish jsonization.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:JsonIO`:`:GetResult`(`)const: [_^Value^ Value]_[* GetResult]()_[@(0.0.255) const]&]
|
||||
[s2;%% Returns JSON node data into [%-*@3 v] when storing `- invoked
|
||||
to finish jsonization.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:JsonIO`:`:operator`(`)`(const char`*`,T`&`): [@(0.0.255) template]_<[@(0.0.255) clas
|
||||
s]_[*@4 T]>_[_^JsonIO^ JsonIO][@(0.0.255) `&]_[* operator()]([@(0.0.255) const]_[@(0.0.255) c
|
||||
har]_`*[*@3 key], [*@4 T][@(0.0.255) `&]_[*@3 value])&]
|
||||
[s2;%% Sets the JsonIO to represent JSON object (if it does not already),
|
||||
creates member [%-*@3 key] and jsonizes [%-*@3 value] into it (by
|
||||
calling global Jsonize function, whose general form invokes Jsonize
|
||||
method)..&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:JsonIO`:`:JsonIO`(const Value`&`): [* JsonIO]([@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&
|
||||
]_[*@3 src])&]
|
||||
[s2;%% Sets JsonIO for retrieving data from [%-*@3 src] which is must
|
||||
be Json compatible Value.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:JsonIO`:`:JsonIO`(`): [* JsonIO]()&]
|
||||
[s2;%% Creates JsonIO for storing data.&]
|
||||
[s3; &]
|
||||
[s0; &]
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 Jsonize Store/Load functions]]}}&]
|
||||
[s3; &]
|
||||
[s5;:StoreAsJsonValue`(const T`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[_^Value^ V
|
||||
alue]_[* StoreAsJsonValue]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s2;%% Converts [%-*@3 var] into JSON compatible Value (such that can
|
||||
be directly used with AsJson function).&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:LoadFromJsonValue`(T`&`,const Value`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T
|
||||
]>_[@(0.0.255) void]_[* LoadFromJsonValue]([*@4 T][@(0.0.255) `&]_[*@3 var],
|
||||
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 x])&]
|
||||
[s2;%% Retrieves variable from JSON compatible Value. Can throw JsonizeError
|
||||
on error.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:StoreAsJson`(const T`&`,bool`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[_^String^ S
|
||||
tring]_[* StoreAsJson]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 var],
|
||||
[@(0.0.255) bool]_[*@3 pretty]_`=_[@(0.0.255) false])&]
|
||||
[s2;%% Converts [%-*@3 var] into JSON text. If [%-*@3 pretty] is true,
|
||||
adds whitespaces to look better, otherwise the result is as compact
|
||||
as possible.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:LoadFromJson`(T`&`,const char`*`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_
|
||||
[@(0.0.255) bool]_[* LoadFromJson]([*@4 T][@(0.0.255) `&]_[*@3 var], [@(0.0.255) const]_[@(0.0.255) c
|
||||
har]_`*[*@3 json])&]
|
||||
[s2;%% Retrieves [%-*@3 var] from [%-*@3 json] text. Does not throw JsonizeError,
|
||||
returns false in case of error.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:StoreAsJsonFile`(const T`&`,const char`*`,bool`): [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 T]>_[@(0.0.255) bool]_[* StoreAsJsonFile]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
|
||||
]_[*@3 var], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 file], [@(0.0.255) bool]_[*@3 pretty
|
||||
]_`=_[@(0.0.255) false])&]
|
||||
[s2;%% Converts [%-*@3 var] into JSON file. If [%-*@3 pretty] is true,
|
||||
adds whitespaces to look better, otherwise the result is as compact
|
||||
as possible.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:LoadFromJsonFile`(T`&`,const char`*`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T
|
||||
]>_[@(0.0.255) bool]_[* LoadFromJsonFile]([*@4 T][@(0.0.255) `&]_[*@3 var],
|
||||
[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 file]_`=_NULL)&]
|
||||
[s2;%% Retrieves [%-*@3 var] from [%-*@3 json] file. Does not throw JsonizeError,
|
||||
returns false in case of error.&]
|
||||
[s3; &]
|
||||
[s0;i448;a25;kKO9;@(0.0.255) &]
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 Standard Jsonize template specializations]]}}&]
|
||||
[s3; &]
|
||||
[s5;:Jsonize`(JsonIO`&`,int`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ J
|
||||
sonIO][@(0.0.255) `&]_[*@3 io], [@(0.0.255) int`&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,int16`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ J
|
||||
sonIO][@(0.0.255) `&]_[*@3 io], [_^int16^ int16][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,int64`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ J
|
||||
sonIO][@(0.0.255) `&]_[*@3 io], [_^int64^ int64][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,double`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize](
|
||||
[_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [@(0.0.255) double`&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,bool`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ J
|
||||
sonIO][@(0.0.255) `&]_[*@3 io], [@(0.0.255) bool`&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,String`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize](
|
||||
[_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [_^String^ String][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,WString`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize](
|
||||
[_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [_^WString^ WString][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,Date`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ J
|
||||
sonIO][@(0.0.255) `&]_[*@3 io], [_^Date^ Date][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,Time`&`): [@(0.0.255) template]_<>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ J
|
||||
sonIO][@(0.0.255) `&]_[*@3 io], [_^Time^ Time][@(0.0.255) `&]_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,Vector`<T`>`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>
|
||||
_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io],
|
||||
[_^Vector^ Vector]<[*@4 T]>`&_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,Array`<T`>`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_
|
||||
[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io],
|
||||
[_^Array^ Array]<[*@4 T]>`&_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,Index`<T`>`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_
|
||||
[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io],
|
||||
[_^Index^ Index]<[*@4 T]>`&_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,ArrayIndex`<T`>`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T
|
||||
]>_[@(0.0.255) void]_[* Jsonize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io],
|
||||
[_^ArrayIndex^ ArrayIndex]<[*@4 T]>`&_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,VectorMap`<K`,V`,H`>`&`): [@(0.0.255) template]_<[@(0.0.255) clas
|
||||
s]_[*@4 K], [@(0.0.255) class]_[*@4 V], [@(0.0.255) class]_[*@4 H]>_[@(0.0.255) void]_[* Jsoniz
|
||||
e]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [_^VectorMap^ VectorMap]<[*@4 K],
|
||||
[*@4 V], [*@4 H]>`&_[*@3 var])&]
|
||||
[s5;:Jsonize`(JsonIO`&`,ArrayMap`<K`,V`,H`>`&`): [@(0.0.255) template]_<[@(0.0.255) class
|
||||
]_[*@4 K], [@(0.0.255) class]_[*@4 V], [@(0.0.255) class]_[*@4 H]>_[@(0.0.255) void]_[* Jsonize
|
||||
]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [_^ArrayMap^ ArrayMap]<[*@4 K],
|
||||
[*@4 V], [*@4 H]>`&_[*@3 var])&]
|
||||
[s2; Provides Jsonize template specialization to support [*@3 var]
|
||||
data type.&]
|
||||
[s3; &]
|
||||
[s0; &]
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 Special Jsonize variants]]}}&]
|
||||
[s3; &]
|
||||
[s5;:StringMap`(JsonIO`&`,VectorMap`<K`,V`,H`>`&`): [@(0.0.255) template]_<[@(0.0.255) cl
|
||||
ass]_[*@4 K], [@(0.0.255) class]_[*@4 V], [@(0.0.255) class]_[*@4 H]>_[@(0.0.255) void]_[* Stri
|
||||
ngMap]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [_^VectorMap^ VectorMap]<[*@4 K],
|
||||
[*@4 V], [*@4 H]>`&_[*@3 map])&]
|
||||
[s5;:StringMap`(JsonIO`&`,ArrayMap`<K`,V`,H`>`&`): [@(0.0.255) template]_<[@(0.0.255) cla
|
||||
ss]_[*@4 K], [@(0.0.255) class]_[*@4 V], [@(0.0.255) class]_[*@4 H]>_[@(0.0.255) void]_[* Strin
|
||||
gMap]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 io], [_^ArrayMap^ ArrayMap]<[*@4 K],
|
||||
[*@4 V], [*@4 H]>`&_[*@3 map])&]
|
||||
[s2;%% The default Jsonize for Maps has to encode any type as key,
|
||||
which leads to somewhat unnatural results when key [%-*@4 K] is
|
||||
String or WString. [%-* StringMap ]alternative variant encodes
|
||||
map as JSON object with keys equal to map keys.&]
|
||||
[s3;%% &]
|
||||
[s4;%% &]
|
||||
[s5;:JsonizeBySerialize`(JsonIO`&`,T`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>
|
||||
_[@(0.0.255) void]_[* JsonizeBySerialize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 jio],
|
||||
[*@4 T][@(0.0.255) `&]_[*@3 x])&]
|
||||
[s2;%% This function encodes/retrieves Json by binary serializing
|
||||
the object and Jsonizing the hexadecimal data string.&]
|
||||
[s3;%% ]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue