Преглед на файлове

#json添加重载方法

zxs преди 2 дни
родител
ревизия
60f7d0aa65
променени са 1 файла, в които са добавени 14 реда и са изтрити 1 реда
  1. 14 1
      robot/robotics/json.hpp

+ 14 - 1
robot/robotics/json.hpp

@@ -85,7 +85,7 @@ namespace robotics {
 						else if (rttr::type::get<std::vector<std::int64_t>>() == property.get_type()) {
 							result[prop_name] = property.get_value(value).get_value<std::vector<std::int64_t>>();
 						}
-						else if (rttr::type::get<int>() == property.get_type()) {
+						else if (rttr::type::get<std::vector<std::string>>() == property.get_type()) {
 							result[prop_name] = property.get_value(value).get_value<std::vector<std::string>>();
 						}
 						else if (rttr::type::get<std::vector<v3::datetime>>() == property.get_type()) {
@@ -456,6 +456,19 @@ namespace robotics {
 				deserialize(json, ret);
 				return result;
 			}
+			/**
+			 * @brief 反序列化
+			 * @tparam _Ret
+			 * @param value
+			 * @param result
+			 * @return
+			 */
+			template<>
+			static rttr::variant deserialize<rttr::variant>(std::string const& value, rttr::variant& result) {
+				nlohmann::json json = nlohmann::json::parse(value);
+				deserialize(json, result);
+				return result;
+			}
 			/**
 			 * @brief 反序列化
 			 * @tparam _Ret