more ai generated doc with human review
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
/*! \file pijson.h
|
||||
* \ingroup Serialization
|
||||
/*! \file pijsonserialization.h
|
||||
* \addtogroup Serialization
|
||||
* \brief
|
||||
* \~english JSON serialization
|
||||
* \~russian Сериализация JSON
|
||||
* \~english JSON serialization and deserialization template functions
|
||||
* \~russian Шаблонные функции сериализации и десериализации JSON
|
||||
* \details
|
||||
* \~english This file provides template functions for serializing and deserializing
|
||||
* various types to and from PIJSON format.
|
||||
* \~russian Этот файл предоставляет шаблонные функции для сериализации и десериализации
|
||||
* различных типов в формат PIJSON и из него.
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
@@ -38,14 +43,14 @@
|
||||
|
||||
template<typename T, typename std::enable_if<std::is_enum<T>::value, int>::type = 0>
|
||||
inline PIJSON piSerializeJSON(const T & v) {
|
||||
return PIJSON() = (int)v;
|
||||
return PIJSON() = (int)v;
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename std::enable_if<!std::is_enum<T>::value, int>::type = 0,
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, int>::type = 0>
|
||||
inline PIJSON piSerializeJSON(const T & v) {
|
||||
return PIJSON() = v;
|
||||
return PIJSON() = v;
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
@@ -53,7 +58,7 @@ template<typename T,
|
||||
typename std::enable_if<!std::is_arithmetic<T>::value, int>::type = 0>
|
||||
inline PIJSON piSerializeJSON(const T & v) {
|
||||
static_assert(std::is_enum<T>::value || std::is_arithmetic<T>::value,
|
||||
"[piSerializeJSON] Error: using undeclared piSerializeJSON() for complex type!");
|
||||
"[piSerializeJSON] Error: using undeclared piSerializeJSON() for complex type!");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -229,14 +234,14 @@ inline PIJSON piSerializeJSON(const PIMap<K, T> & v) {
|
||||
|
||||
template<typename T, typename std::enable_if<std::is_enum<T>::value, int>::type = 0>
|
||||
inline void piDeserializeJSON(T & v, const PIJSON & js) {
|
||||
v = (T)js.toInt();
|
||||
v = (T)js.toInt();
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename std::enable_if<!std::is_enum<T>::value, int>::type = 0,
|
||||
typename std::enable_if<std::is_arithmetic<T>::value, int>::type = 0>
|
||||
inline void piDeserializeJSON(T & v, const PIJSON & js) {
|
||||
v = js.value().value<T>();
|
||||
v = js.value().value<T>();
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
@@ -244,7 +249,7 @@ template<typename T,
|
||||
typename std::enable_if<!std::is_arithmetic<T>::value, int>::type = 0>
|
||||
inline void piDeserializeJSON(T & v, const PIJSON & js) {
|
||||
static_assert(std::is_enum<T>::value || std::is_arithmetic<T>::value,
|
||||
"[piDeserializeJSON] Error: using undeclared piDeserializeJSON() for complex type!");
|
||||
"[piDeserializeJSON] Error: using undeclared piDeserializeJSON() for complex type!");
|
||||
v = {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user