Line data Source code
1 : #ifndef OUT_STRING_HPP
2 : #define OUT_STRING_HPP
3 :
4 : #include "out_data.hpp"
5 :
6 : namespace thinger::http::data{
7 :
8 : class out_string : public out_data{
9 :
10 : public:
11 18 : out_string(const std::string& str) : str_(str){
12 18 : }
13 :
14 : out_string(){
15 : }
16 :
17 18 : virtual ~out_string() {
18 18 : }
19 :
20 : std::string& get_string(){
21 : return str_;
22 : }
23 :
24 18 : size_t get_size() override{
25 18 : return str_.size();
26 : }
27 :
28 3 : void to_buffer(std::vector<boost::asio::const_buffer>& buffer) const override{
29 3 : buffer.emplace_back(boost::asio::buffer(str_));
30 3 : }
31 :
32 : private:
33 : std::string str_;
34 : };
35 :
36 : }
37 :
38 : #endif
|