22 #include "cafAppEnum.h" 23 #include "cafObjectHandlePortableDataType.h" 24 #include "cafPortableDataType.h" 26 #include <nlohmann/json.hpp> 35 template <
class Rep,
class Period>
40 template <
class Clock,
class Duration>
45 template <
typename _Tp>
48 template <
typename _Tp>
49 concept supported_integral = ( std::integral<_Tp> || chrono_integral<_Tp> ) && !std::is_same<_Tp, bool>::value;
54 template <
typename DataType>
57 static nlohmann::json jsonType()
59 auto object = nlohmann::json::object();
69 static nlohmann::json jsonType() {
return nlohmann::json::object(); }
72 template <
typename DataType>
75 static nlohmann::json jsonType()
77 auto object = nlohmann::json::object();
78 object[
"type"] =
"array";
85 template <supported_
integral DataType>
88 static nlohmann::json jsonType()
90 auto object = nlohmann::json::object();
91 object[
"type"] =
"integer";
97 template <std::
floating_po
int DataType>
100 static nlohmann::json jsonType()
102 auto object = nlohmann::json::object();
103 object[
"type"] =
"number";
112 template <DerivesFromObjectHandle DataType>
115 static nlohmann::json jsonType()
117 auto object = nlohmann::json::object();
118 object[
"$ref"] = std::string(
"#/components/object_schemas/" ) + DataType::classKeywordStatic();
126 template <IsSharedPtr DataType>
129 static nlohmann::json jsonType()
131 auto object = nlohmann::json::object();
132 object[
"$ref"] = std::string(
"#/components/object_schemas/" ) + DataType::element_type::classKeywordStatic();
137 template <
typename EnumType>
140 static nlohmann::json jsonType()
142 auto values = nlohmann::json::array();
145 values.push_back( entry );
147 auto object = nlohmann::json::object();
148 object[
"enum"] = values;
153 template <
typename Enum>
154 void to_json( nlohmann::json& jsonValue,
const AppEnum<Enum>& appEnum )
156 std::stringstream stream;
158 jsonValue = stream.str();
161 template <
typename Enum>
162 void from_json(
const nlohmann::json& jsonValue,
AppEnum<Enum>& appEnum )
164 std::stringstream stream( jsonValue.get<std::string>() );
Definition: cafJsonDataType.h:31
Definition: cafJsonDataType.h:55
Definition: cafPortableDataType.h:35
Definition: cafAppEnum.h:65
Main Caffa namespace.
Definition: cafApplication.h:30