# HG changeset patch # User Alain Mazy # Date 1556532115 -7200 # Node ID 8432926e9db90d6fac9f18d8c86cb33118afcb33 # Parent 848170ca4351a007831a9aaf4d9b11853f7d090b codegen tools: support for int64, uint32, uint64 diff -r 848170ca4351 -r 8432926e9db9 Resources/CodeGeneration/stonegentool.py --- a/Resources/CodeGeneration/stonegentool.py Tue Apr 23 10:15:54 2019 +0200 +++ b/Resources/CodeGeneration/stonegentool.py Mon Apr 29 12:01:55 2019 +0200 @@ -76,7 +76,7 @@ def CanonToCpp(canonicalTypename): # C++: prefix map vector and string with std::map, std::vector and # std::string - # replace int32 by int32_t + # replace int32... by int32_t... # replace float32 by float # replace float64 by double retVal = canonicalTypename @@ -84,7 +84,9 @@ retVal = retVal.replace("vector", "std::vector") retVal = retVal.replace("set", "std::set") retVal = retVal.replace("string", "std::string") + #uint32 and uint64 are handled by int32 and uint32 (because search and replace are done as partial words) retVal = retVal.replace("int32", "int32_t") + retVal = retVal.replace("int64", "int64_t") retVal = retVal.replace("float32", "float") retVal = retVal.replace("float64", "double") retVal = retVal.replace("json", "Json::Value") @@ -93,14 +95,16 @@ def CanonToTs(canonicalTypename): # TS: replace vector with Array and map with Map # string remains string - # replace int32 by number - # replace float32 by number - # replace float64 by number + # replace int32... by number + # replace float32... by number retVal = canonicalTypename retVal = retVal.replace("map", "Map") retVal = retVal.replace("vector", "Array") retVal = retVal.replace("set", "Set") + retVal = retVal.replace("uint32", "number") + retVal = retVal.replace("uint64", "number") retVal = retVal.replace("int32", "number") + retVal = retVal.replace("int64", "number") retVal = retVal.replace("float32", "number") retVal = retVal.replace("float64", "number") retVal = retVal.replace("bool", "boolean") diff -r 848170ca4351 -r 8432926e9db9 Resources/CodeGeneration/template.in.h.j2 --- a/Resources/CodeGeneration/template.in.h.j2 Tue Apr 23 10:15:54 2019 +0200 +++ b/Resources/CodeGeneration/template.in.h.j2 Mon Apr 29 12:01:55 2019 +0200 @@ -38,6 +38,39 @@ return result; } + inline void _StoneDeserializeValue(int64_t& destValue, const Json::Value& jsonValue) + { + destValue = jsonValue.asInt64(); + } + + inline Json::Value _StoneSerializeValue(int64_t value) + { + Json::Value result(value); + return result; + } + + inline void _StoneDeserializeValue(uint32_t& destValue, const Json::Value& jsonValue) + { + destValue = jsonValue.asUInt(); + } + + inline Json::Value _StoneSerializeValue(uint32_t value) + { + Json::Value result(value); + return result; + } + + inline void _StoneDeserializeValue(uint64_t& destValue, const Json::Value& jsonValue) + { + destValue = jsonValue.asUInt64(); + } + + inline Json::Value _StoneSerializeValue(uint64_t value) + { + Json::Value result(value); + return result; + } + inline void _StoneDeserializeValue(Json::Value& destValue, const Json::Value& jsonValue) { destValue = jsonValue;