Fork of OAuth4Tw to use mbed's official EthernetInterface and HTTPClient

Fork of OAuth4Tw by Masayoshi Takahashi

Revision:
1:b3501683b856
diff -r 0048b264a3ad -r b3501683b856 oauth_data.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oauth_data.h	Thu Apr 30 10:19:31 2015 +0000
@@ -0,0 +1,70 @@
+#ifndef __OAUTHDATA_H__
+#define __OAUTHDATA_H__
+
+/**
+ * Author : Cola Vergil
+ * Email  : vpcola@gmail.com
+ * Date : Thu Apr 30 2015
+ **/
+
+#include <IHTTPData.h>
+#include <string>
+
+class OAuthDataOut : public IHTTPDataOut
+{
+    public:
+    /** Create an HTTPText instance for output
+     * @param str String to be transmitted
+     */
+    OAuthDataOut(const char * contentType, const char * data);
+
+
+    protected:
+    //IHTTPDataOut
+    virtual void readReset();
+
+    virtual int read(char* buf, size_t len, size_t* pReadLen);
+
+    virtual int getDataType(char* type, size_t maxTypeLen);
+
+    virtual bool getIsChunked();
+
+    virtual size_t getDataLen();
+
+    private:
+    char * m_str;
+    std::string m_contentType;
+    size_t m_size;
+    size_t m_pos;
+    bool m_isChunked;
+};
+
+class OAuthDataIn : public IHTTPDataIn
+{
+    public:
+
+    OAuthDataIn(char* str, size_t size);
+    std::string getContentType();
+    std::string getData();
+
+    protected:
+    //IHTTPDataIn
+    virtual void writeReset();
+
+    virtual int write(const char* buf, size_t len);
+
+    virtual void setDataType(const char* type); //Internet media type for Content-Type header
+
+    virtual void setIsChunked(bool chunked); //For Transfer-Encoding header
+
+    virtual void setDataLen(size_t len); //For Content-Length header
+
+    private:
+    char * m_str;
+    std::string m_contentType;
+    size_t m_size;
+    size_t m_pos;
+     bool m_isChunked;
+};
+
+#endif