version 4.8.0
fix PICodeParser: complex static array dimensions, member template types for multideclaration PIJSON::serialize and PIJSON::deserialize helpers
This commit is contained in:
@@ -191,6 +191,12 @@ public:
|
||||
static PIJSON newArray(const PIVariantVector & fields = {});
|
||||
static PIJSON newString(const PIString & v = PIString());
|
||||
|
||||
template<typename T>
|
||||
static PIJSON serialize(const T & v);
|
||||
|
||||
template<typename T>
|
||||
static T deserialize(const PIJSON & json);
|
||||
|
||||
private:
|
||||
static PIJSON & nullEntry();
|
||||
static PIString parseName(PIString & s);
|
||||
|
||||
@@ -392,4 +392,22 @@ inline void piDeserializeJSON(PIMap<K, T> & v, const PIJSON & js) {
|
||||
}
|
||||
|
||||
|
||||
// ---
|
||||
// PIJSON static wrapper
|
||||
// ---
|
||||
|
||||
|
||||
template<typename T>
|
||||
PIJSON PIJSON::serialize(const T & v) {
|
||||
return piSerializeJSON(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T PIJSON::deserialize(const PIJSON & json) {
|
||||
T ret;
|
||||
piDeserializeJSON(ret, json);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#endif // pijsonserialization_h
|
||||
|
||||
Reference in New Issue
Block a user