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 21 : out_string(const std::string& str) : str_(str){
12 21 : }
13 :
14 14333 : out_string(){
15 14333 : }
16 :
17 14354 : virtual ~out_string() {
18 14354 : }
19 :
20 14333 : std::string& get_string(){
21 14333 : return str_;
22 : }
23 :
24 18 : size_t get_size() override{
25 18 : return str_.size();
26 : }
27 :
28 14336 : void to_buffer(std::vector<boost::asio::const_buffer>& buffer) const override{
29 14336 : buffer.emplace_back(boost::asio::buffer(str_));
30 14336 : }
31 :
32 : private:
33 : std::string str_;
34 : };
35 :
36 : }
37 :
38 : #endif
|