Dependents: SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1
Diff: services/http/client/data/HttpMap.h
- Revision:
- 0:a2dd0ba6cd2d
- Child:
- 1:7043cc0db03c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/services/http/client/data/HttpMap.h Mon May 24 10:24:38 2010 +0000 @@ -0,0 +1,44 @@ +#ifndef HTTP_MAP_H +#define HTTP_MAP_H + +#include "../HttpData.h" +#include "mbed.h" + +#include <map> +using std::map; + +typedef map<string, string> Dictionary; + +class HttpMap : public HttpData, public Dictionary //Key/Value pairs +{ +public: + HttpMap(); + virtual ~HttpMap(); + + /* string& operator[](const string& key); + int count();*/ + + +protected: + virtual int read(char* buf, int len); + virtual int write(const char* buf, int len); + + virtual string getDataType(); //Internet media type for Content-Type header + virtual void setDataType(const string& type); //Internet media type from Content-Type header + + virtual bool getIsChunked(); //For Transfer-Encoding header + virtual void setIsChunked(bool chunked); //From Transfer-Encoding header + + virtual int getDataLen(); //For Content-Length header + virtual void setDataLen(int len); //From Content-Length header + +private: + void generateString(); + void parseString(); + //map<string, string> m_map; + string m_buf; + int m_len; + bool m_chunked; +}; + +#endif