diff options
| author | George Hazan <george.hazan@gmail.com> | 2025-03-30 11:35:03 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2025-03-30 11:35:03 +0300 |
| commit | 7d95e67308ee0abcce5c7bd66265146d3dfefd74 (patch) | |
| tree | 9c377087518bb53a429151edb6a947fc47e89242 /include/m_netlib.h | |
| parent | 66821b916cc298111f9e5ddd2684d15ff7909f02 (diff) | |
useful helper JsonReply moved to the core
Diffstat (limited to 'include/m_netlib.h')
| -rw-r--r-- | include/m_netlib.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/m_netlib.h b/include/m_netlib.h index 421ca5b05c..71e2696c4f 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -503,6 +503,20 @@ public: }
};
+class MIR_APP_EXPORT JsonReply : public MNonCopyable
+{
+ class JSONNode *m_root = nullptr;
+ int m_errorCode = 0;
+
+public:
+ explicit JsonReply(MHttpResponse *response);
+ ~JsonReply();
+
+ __forceinline JSONNode &data() const { return *m_root; }
+ __forceinline int error() const { return m_errorCode; }
+ __forceinline operator bool() const { return m_errorCode == 200; }
+};
+
/////////////////////////////////////////////////////////////////////////////////////////
// Free the memory used by a MHttpRequest structure
//
|
