staticlib_http  1.3.2
 All Classes Namespaces Files Functions Variables
resource.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2016, alex at staticlibs.net
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * File: resource.hpp
19  * Author: alex
20  *
21  * Created on November 20, 2015, 8:43 AM
22  */
23 
24 #ifndef STATICLIB_HTTP_RESOURCE_HPP
25 #define STATICLIB_HTTP_RESOURCE_HPP
26 
27 #include <ios>
28 #include <istream>
29 #include <memory>
30 #include <string>
31 #include <utility>
32 #include <vector>
33 
34 #include "staticlib/config.hpp"
35 #include "staticlib/io/unbuffered_streambuf.hpp"
36 #include "staticlib/pimpl.hpp"
37 
41 
42 namespace staticlib {
43 namespace http {
44 
48 class resource : public sl::pimpl::object {
49 protected:
53  class impl;
54 
55 public:
61  PIMPL_CONSTRUCTOR(resource)
62 
63 
69  virtual std::streamsize read(sl::io::span<char> span);
70 
76  virtual const std::string& get_url() const;
77 
83  virtual uint16_t get_status_code() const;
84 
90  virtual resource_info get_info() const;
91 
97  virtual const std::vector<std::pair<std::string, std::string>>& get_headers() const;
98 
106  virtual const std::string& get_header(const std::string& name) const;
107 
114  virtual bool connection_successful() const;
115 
116 };
117 
118 } // namespace
119 }
120 
121 #endif /* STATICLIB_HTTP_RESOURCE_HPP */
122