summaryrefslogtreecommitdiff
path: root/include/m_netlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/m_netlib.h')
-rw-r--r--include/m_netlib.h14
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
//