HTTP Client library
Dependents: weather_LCD_display News_LCD_display TwitterExample_1 GeoLocation_LCD_Display ... more
HTTPText.h
00001 /* HTTPText.h */ 00002 /* 00003 Copyright (C) 2012 ARM Limited. 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy of 00006 this software and associated documentation files (the "Software"), to deal in 00007 the Software without restriction, including without limitation the rights to 00008 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00009 of the Software, and to permit persons to whom the Software is furnished to do 00010 so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in all 00013 copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00021 SOFTWARE. 00022 */ 00023 00024 00025 #ifndef HTTPTEXT_H_ 00026 #define HTTPTEXT_H_ 00027 00028 #include "../IHTTPData.h" 00029 00030 /** A data endopint to store text 00031 */ 00032 class HTTPText : public IHTTPDataIn, public IHTTPDataOut 00033 { 00034 public: 00035 /** Create an HTTPText instance for output 00036 * @param str String to be transmitted 00037 */ 00038 HTTPText(char* str); 00039 00040 /** Create an HTTPText instance for input 00041 * @param str Buffer to store the incoming string 00042 * @param size Size of the buffer 00043 */ 00044 HTTPText(char* str, size_t size); 00045 00046 protected: 00047 //IHTTPDataIn 00048 virtual int read(char* buf, size_t len, size_t* pReadLen); 00049 00050 virtual int getDataType(char* type, size_t maxTypeLen); //Internet media type for Content-Type header 00051 00052 virtual bool getIsChunked(); //For Transfer-Encoding header 00053 00054 virtual size_t getDataLen(); //For Content-Length header 00055 00056 //IHTTPDataOut 00057 virtual int write(const char* buf, size_t len); 00058 00059 virtual void setDataType(const char* type); //Internet media type from Content-Type header 00060 00061 virtual void setIsChunked(bool chunked); //From Transfer-Encoding header 00062 00063 virtual void setDataLen(size_t len); //From Content-Length header, or if the transfer is chunked, next chunk length 00064 00065 private: 00066 char* m_str; 00067 size_t m_size; 00068 00069 size_t m_pos; 00070 }; 00071 00072 #endif /* HTTPTEXT_H_ */
Generated on Tue Jul 12 2022 20:54:55 by
![doxygen](doxygen.png)