29 #include <system_error>
30 #include "cpprest/asyncrt_utils.h"
32 namespace web {
namespace http {
42 template<
typename key_type,
typename _t>
43 CASABLANCA_DEPRECATED(
"This API is deprecated and will be removed in a future release, std::istringstream instead.")
44 bool
bind(const key_type &text, _t &ref)
46 utility::istringstream_t iss(text);
48 if (iss.fail() || !iss.eof())
64 template <
typename key_type>
65 CASABLANCA_DEPRECATED(
"This API is deprecated and will be removed in a future release.")
81 bool operator()(
const utility::string_t &str1,
const utility::string_t &str2)
const
84 return _wcsicmp(str1.c_str(), str2.c_str()) < 0;
86 return utility::cmp::icmp(str1, str2) < 0;
94 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::key_type
key_type;
95 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::key_compare key_compare;
96 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::allocator_type allocator_type;
97 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::size_type size_type;
98 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::difference_type difference_type;
99 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::pointer pointer;
100 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::const_pointer const_pointer;
101 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::reference reference;
102 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::const_reference const_reference;
103 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::iterator iterator;
104 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::const_iterator const_iterator;
105 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::reverse_iterator reverse_iterator;
106 typedef std::map<utility::string_t, utility::string_t, _case_insensitive_cmp>::const_reverse_iterator const_reverse_iterator;
127 m_headers = other.m_headers;
146 m_headers = std::move(other.m_headers);
157 template<
typename _t1>
158 void add(
const key_type& name,
const _t1& value)
162 m_headers[name] = m_headers[name].append(_XPLATSTR(
", ") + utility::conversions::print_string(value));
166 m_headers[name] = utility::conversions::print_string(value);
174 void remove(
const key_type& name)
176 m_headers.erase(name);
189 bool has(
const key_type& name)
const {
return m_headers.find(name) != m_headers.end(); }
195 size_type
size()
const {
return m_headers.size(); }
201 bool empty()
const {
return m_headers.empty(); }
206 utility::string_t &
operator[](
const key_type &name) {
return m_headers[name]; }
214 iterator
find(
const key_type &name) {
return m_headers.find(name); }
215 const_iterator
find(
const key_type &name)
const {
return m_headers.find(name); }
223 template<
typename _t1>
224 bool match(
const key_type &name, _t1 &value)
const
226 auto iter = m_headers.find(name);
227 if (iter != m_headers.end())
230 if(iter->second.empty())
232 bind_impl(iter->second, value);
235 return bind_impl(iter->second, value);
247 iterator
begin() {
return m_headers.begin(); }
248 const_iterator
begin()
const {
return m_headers.begin(); }
254 iterator
end() {
return m_headers.end(); }
255 const_iterator
end()
const {
return m_headers.end(); }
297 _ASYNCRTIMP utility::string_t
date()
const;
307 template<
typename _t>
308 bool bind_impl(
const key_type &text, _t &ref)
const
310 utility::istringstream_t iss(text);
311 iss.imbue(std::locale::classic());
313 if (iss.fail() || !iss.eof())
321 bool bind_impl(
const key_type &text, ::utility::string_t &ref)
const
328 std::map<utility::string_t, utility::string_t, _case_insensitive_cmp> m_headers;
bool bind(const key_type &text, _t &ref)
Binds an individual reference to a string value.
Definition: http_headers.h:44
Definition: asyncrt_utils.h:370
The web namespace contains functionality common to multiple protocols like HTTP and WebSockets...
Definition: base_uri.h:37
Various utilities for string conversions and date and time manipulation.
Definition: asyncrt_utils.h:50