]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/net/cellular/http/common/HTTPClient/data/HTTPText.h
2 /* Copyright (C) 2012 mbed.org, MIT License
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in all copies or
11 * substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #include "../IHTTPData.h"
26 /** A data endpoint to store text
28 class HTTPText
: public IHTTPDataIn
, public IHTTPDataOut
31 /** Create an HTTPText instance for output
32 * @param str String to be transmitted
36 /** Create an HTTPText instance for input
37 * @param str Buffer to store the incoming string
38 * @param size Size of the buffer
40 HTTPText(char* str
, size_t size
);
44 virtual void readReset();
46 virtual int read(char* buf
, size_t len
, size_t* pReadLen
);
48 virtual int getDataType(char* type
, size_t maxTypeLen
); //Internet media type for Content-Type header
50 virtual bool getIsChunked(); //For Transfer-Encoding header
52 virtual size_t getDataLen(); //For Content-Length header
55 virtual void writeReset();
57 virtual int write(const char* buf
, size_t len
);
59 virtual void setDataType(const char* type
); //Internet media type from Content-Type header
61 virtual void setIsChunked(bool chunked
); //From Transfer-Encoding header
63 virtual void setDataLen(size_t len
); //From Content-Length header, or if the transfer is chunked, next chunk length
72 #endif /* HTTPTEXT_H_ */