review fixes
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef pijsonserialization_H
|
||||
#define pijsonserialization_H
|
||||
#ifndef PIJSONSERIALIZATION_H
|
||||
#define PIJSONSERIALIZATION_H
|
||||
|
||||
#include "pijson.h"
|
||||
|
||||
@@ -191,8 +191,8 @@ inline PIJSON piSerializeJSON(const PIDeque<T> & v) {
|
||||
template<typename T>
|
||||
inline PIJSON piSerializeJSON(const PIVector2D<T> & v) {
|
||||
PIJSON ret;
|
||||
ret["cols"] = v.cols();
|
||||
ret["rows"] = v.rows();
|
||||
ret["cols"] = static_cast<uint>(v.cols());
|
||||
ret["rows"] = static_cast<uint>(v.rows());
|
||||
ret["mat"] = piSerializeJSON(v.plainVector());
|
||||
return ret;
|
||||
}
|
||||
@@ -255,10 +255,9 @@ inline void piDeserializeJSON(PIVariant & v, const PIJSON & js) {
|
||||
|
||||
template<typename T>
|
||||
inline void piDeserializeJSON(complex<T> & v, const PIJSON & js) {
|
||||
T c[2];
|
||||
piDeserializeJSON(c[0], js[0]);
|
||||
piDeserializeJSON(c[1], js[1]);
|
||||
v = complex<T>(c[0], c[1]);
|
||||
if (!js.isArray()) return;
|
||||
piDeserializeJSON(reinterpret_cast<T(&)[2]>(v)[0], js[0]);
|
||||
piDeserializeJSON(reinterpret_cast<T(&)[2]>(v)[1], js[1]);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -366,10 +365,10 @@ template<typename T>
|
||||
inline void piDeserializeJSON(PIVector2D<T> & v, const PIJSON & js) {
|
||||
v.clear();
|
||||
if (!js.isObject()) return;
|
||||
v.resize(js["rows"].toInt(), js["cols"].toInt());
|
||||
const auto & mat(js["mat"]);
|
||||
if (!mat.isArray()) return;
|
||||
piDeserializeJSON(v.plainVector(), mat);
|
||||
v.resize(js["rows"].toInt(), js["cols"].toInt());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -412,4 +411,4 @@ T PIJSON::deserialize(const PIJSON & json) {
|
||||
}
|
||||
|
||||
|
||||
#endif // pijsonserialization_h
|
||||
#endif // PIJSONSERIALIZATION_H
|
||||
|
||||
Reference in New Issue
Block a user