summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-11 12:04:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-11 12:04:28 +0300
commit322fece4cdb97f834c3c13b7bb3157ba6e4fa449 (patch)
treeab02c0681f9c9bb1adc1038b251f502dcdb49638 /include
parent4abcb6d6a611b10f32d803270b7f2480fbb6865e (diff)
parameters unification between JSON & HTTP
Diffstat (limited to 'include')
-rw-r--r--include/m_json.h8
-rw-r--r--include/m_system_cpp.h50
2 files changed, 57 insertions, 1 deletions
diff --git a/include/m_json.h b/include/m_json.h
index d63c6184e4..dfbc293022 100644
--- a/include/m_json.h
+++ b/include/m_json.h
@@ -126,6 +126,8 @@ LIBJSON_DLL(JSONNode*) json_pop_back(JSONNode *node, const char *name);
//comparison
LIBJSON_DLL(int) json_equal(JSONNode *node, JSONNode *node2);
+}
+
#ifdef __cplusplus
class JSONROOT
@@ -142,7 +144,11 @@ public:
__forceinline JSONNode* Parse(LPCSTR text) { return (m_node = json_parse(text)); }
};
-}
+LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const INT_PARAM &param);
+LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const INT64_PARAM &param);
+LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const BOOL_PARAM &param);
+LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const CHAR_PARAM &param);
+LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const WCHAR_PARAM &param);
#endif // __cplusplus
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h
index be7c6ff84f..e26ef5a3de 100644
--- a/include/m_system_cpp.h
+++ b/include/m_system_cpp.h
@@ -319,6 +319,56 @@ public:
void remove(size_t sz);
};
+///////////////////////////////////////////////////////////////////////////////
+// parameter classes for XML, JSON & HTTP requests
+
+struct PARAM
+{
+ const char *szName;
+ __forceinline PARAM(const char *_name) : szName(_name)
+ {}
+};
+
+struct BOOL_PARAM : public PARAM
+{
+ bool bValue;
+ __forceinline BOOL_PARAM(const char *_name, bool _value) :
+ PARAM(_name), bValue(_value)
+ {}
+};
+
+struct INT_PARAM : public PARAM
+{
+ int32_t iValue;
+ __forceinline INT_PARAM(const char *_name, int32_t _value) :
+ PARAM(_name), iValue(_value)
+ {}
+};
+
+struct INT64_PARAM : public PARAM
+{
+ int64_t iValue;
+ __forceinline INT64_PARAM(const char *_name, int64_t _value) :
+ PARAM(_name), iValue(_value)
+ {}
+};
+
+struct CHAR_PARAM : public PARAM
+{
+ const char *szValue;
+ __forceinline CHAR_PARAM(const char *_name, const char *_value) :
+ PARAM(_name), szValue(_value)
+ {}
+};
+
+struct WCHAR_PARAM : public PARAM
+{
+ const wchar_t *wszValue;
+ __forceinline WCHAR_PARAM(const char *_name, const wchar_t *_value) :
+ PARAM(_name), wszValue(_value)
+ {}
+};
+
#endif
#endif // M_SYSTEM_CPP_H