forked from glynos/cpp-netlib
-
Notifications
You must be signed in to change notification settings - Fork 424
Expand file tree
/
Copy pathconstants.hpp
More file actions
137 lines (104 loc) · 2.95 KB
/
constants.hpp
File metadata and controls
137 lines (104 loc) · 2.95 KB
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
#ifndef BOOST_NETWORK_CONSTANTS_HPP_20100808
#define BOOST_NETWORK_CONSTANTS_HPP_20100808
// Copyright 2010 (C) Dean Michael Berris
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/mpl/if.hpp>
#include <boost/network/support/is_default_string.hpp>
#include <boost/network/support/is_default_wstring.hpp>
namespace boost {
namespace network {
namespace impl {
template <class Tag>
struct constants_narrow {
static char const* crlf() {
static char crlf_[] = "\r\n";
return crlf_;
}
static char const* dot() {
static char dot_[] = ".";
return dot_;
}
static char dot_char() { return '.'; }
static char const* http_slash() {
static char http_slash_[] = "HTTP/";
return http_slash_;
}
static char const* space() {
static char space_[] = " ";
return space_;
}
static char space_char() { return ' '; }
static char const* slash() {
static char slash_[] = "/";
return slash_;
}
static char slash_char() { return '/'; }
static char const* host() {
static char host_[] = "Host";
return host_;
}
static char const* colon() {
static char colon_[] = ":";
return colon_;
}
static char colon_char() { return ':'; }
static char const* accept() {
static char accept_[] = "Accept";
return accept_;
}
static char const* default_accept_mime() {
static char mime_[] = "*/*";
return mime_;
}
static char const* accept_encoding() {
static char accept_encoding_[] = "Accept-Encoding";
return accept_encoding_;
}
static char const* default_accept_encoding() {
static char default_accept_encoding_[] = "identity;q=1.0, *;q=0";
return default_accept_encoding_;
}
static char const* user_agent() {
static char user_agent_[] = "User-Agent";
return user_agent_;
}
static char const* cpp_netlib_slash() {
static char cpp_netlib_slash_[] = "cpp-netlib/";
return cpp_netlib_slash_;
}
static char question_mark_char() { return '?'; }
static char hash_char() { return '#'; }
static char const* connection() {
static char connection_[] = "Connection";
return connection_;
}
static char const* close() {
static char close_[] = "Close";
return close_;
}
static char const* https() {
static char https_[] = "https";
return https_;
}
};
template <class Tag>
struct constants_wide {
static wchar_t const* https() {
static wchar_t https_[] = L"https";
return https_;
}
};
} // namespace impl
template <class Tag>
struct unsupported_tag;
template <class Tag>
struct constants
: mpl::if_<
is_default_string<Tag>, impl::constants_narrow<Tag>,
typename mpl::if_<is_default_wstring<Tag>, impl::constants_wide<Tag>,
unsupported_tag<Tag> >::type>::type {};
} // namespace network
} // namespace boost
#endif // BOOST_NETWORK_CONSTANTS_HPP_20100808