/usr/include/corvusoft/restbed/request.hpp is in librestbed-dev 4.0~dfsg1-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | /*
* Copyright 2013-2016, Corvusoft Ltd, All Rights Reserved.
*/
#ifndef _RESTBED_REQUEST_H
#define _RESTBED_REQUEST_H 1
//System Includes
#include <map>
#include <string>
#include <memory>
#include <cstdint>
#include <functional>
//Project Includes
#include <corvusoft/restbed/byte.hpp>
#include <corvusoft/restbed/string.hpp>
//External Includes
//System Namespaces
//Project Namespaces
//External Namespaces
namespace restbed
{
//Forward Declarations
class Uri;
class Http;
class Session;
class Response;
namespace detail
{
class HttpImpl;
class SessionImpl;
class ServiceImpl;
struct RequestImpl;
}
class Request
{
public:
//Friends
//Definitions
//Constructors
Request( void );
Request( const Uri& uri );
virtual ~Request( void );
//Functionality
bool has_header( const std::string& name ) const;
bool has_path_parameter( const std::string& name, const String::Option option = String::CASE_INSENSITIVE ) const;
bool has_query_parameter( const std::string& name, const String::Option option = String::CASE_INSENSITIVE ) const;
//Getters
uint16_t get_port( void ) const;
double get_version( void ) const;
const Bytes& get_body( void ) const;
const std::shared_ptr< const Response > get_response( void ) const;
std::string get_host( const std::function< std::string ( const std::string& ) >& transform = nullptr ) const;
std::string get_path( const std::function< std::string ( const std::string& ) >& transform = nullptr ) const;
std::string get_method( const std::function< std::string ( const std::string& ) >& transform = nullptr ) const;
std::string get_protocol( const std::function< std::string ( const std::string& ) >& transform = nullptr ) const;
void get_body( std::string& body, const std::function< std::string ( const Bytes& ) >& transform = nullptr ) const;
void get_header( const std::string& name, int& value, const int default_value = 0 ) const;
void get_header( const std::string& name, long& value, const long default_value = 0 ) const;
void get_header( const std::string& name, float& value, const float default_value = 0 ) const;
void get_header( const std::string& name, double& value, const double default_value = 0 ) const;
void get_header( const std::string& name, long long& value, const long long default_value = 0 ) const;
void get_header( const std::string& name, unsigned int& value, const unsigned int default_value = 0 ) const;
void get_header( const std::string& name, unsigned long& value, const unsigned long default_value = 0 ) const;
void get_header( const std::string& name, unsigned long long& value, const unsigned long long default_value = 0 ) const;
std::multimap< std::string, std::string > get_headers( const std::string& name = "" ) const;
std::string get_header( const std::string& name, const std::string& default_value = "" ) const;
std::string get_header( const std::string& name, const std::function< std::string ( const std::string& ) >& transform ) const;
void get_query_parameter( const std::string& name, int& value, const int default_value = 0 ) const;
void get_query_parameter( const std::string& name, long& value, const long default_value = 0 ) const;
void get_query_parameter( const std::string& name, float& value, const float default_value = 0 ) const;
void get_query_parameter( const std::string& name, double& value, const double default_value = 0 ) const;
void get_query_parameter( const std::string& name, long long& value, const long long default_value = 0 ) const;
void get_query_parameter( const std::string& name, unsigned int& value, const unsigned int default_value = 0 ) const;
void get_query_parameter( const std::string& name, unsigned long& value, const unsigned long default_value = 0 ) const;
void get_query_parameter( const std::string& name, unsigned long long& value, const unsigned long long default_value = 0 ) const;
std::string get_query_parameter( const std::string& name, const String::Option option = String::CASE_INSENSITIVE ) const;
std::string get_query_parameter( const std::string& name, const std::string& default_value, const String::Option option = String::CASE_INSENSITIVE ) const;
std::string get_query_parameter( const std::string& name, const std::function< std::string ( const std::string& ) >& transform, const String::Option option = String::CASE_INSENSITIVE ) const;
std::multimap< std::string, std::string > get_query_parameters( const std::string& name = "", const String::Option option = String::CASE_INSENSITIVE ) const;
void get_path_parameter( const std::string& name, int& value, const int default_value = 0 ) const;
void get_path_parameter( const std::string& name, long& value, const long default_value = 0 ) const;
void get_path_parameter( const std::string& name, float& value, const float default_value = 0 ) const;
void get_path_parameter( const std::string& name, double& value, const double default_value = 0 ) const;
void get_path_parameter( const std::string& name, long long& value, const long long default_value = 0 ) const;
void get_path_parameter( const std::string& name, unsigned int& value, const unsigned int default_value = 0 ) const;
void get_path_parameter( const std::string& name, unsigned long& value, const unsigned long default_value = 0 ) const;
void get_path_parameter( const std::string& name, unsigned long long& value, const unsigned long long default_value = 0 ) const;
std::string get_path_parameter( const std::string& name, const String::Option option = String::CASE_INSENSITIVE ) const;
std::string get_path_parameter( const std::string& name, const std::string& default_value, const String::Option option = String::CASE_INSENSITIVE ) const;
std::string get_path_parameter( const std::string& name, const std::function< std::string ( const std::string& ) >& transform, const String::Option option = String::CASE_INSENSITIVE ) const;
std::map< std::string, std::string > get_path_parameters( const std::string& name = "", const String::Option option = String::CASE_INSENSITIVE ) const;
//Setters
void set_body( const Bytes& value );
void set_body( const std::string& value );
void set_port( const uint16_t value );
void set_version( const double value );
void set_path( const std::string& value );
void set_host( const std::string& value );
void set_method( const std::string& value );
void set_protocol( const std::string& value );
void set_header( const std::string& name, const std::string& value );
void set_headers( const std::multimap< std::string, std::string >& values );
void set_query_parameter( const std::string& name, const std::string& value );
void set_query_parameters( const std::multimap< std::string, std::string >& values );
//Operators
//Properties
protected:
//Friends
//Definitions
//Constructors
//Functionality
//Getters
//Setters
//Operators
//Properties
private:
//Friends
friend Http;
friend Session;
friend detail::HttpImpl;
friend detail::SessionImpl;
friend detail::ServiceImpl;
//Definitions
//Constructors
Request( const Request& original ) = delete;
//Functionality
//Getters
//Setters
//Operators
Request& operator =( const Request& value ) = delete;
//Properties
detail::RequestImpl* m_pimpl;
};
}
#endif /* _RESTBED_REQUEST_H */
|