|
| 1 | +#ifndef BOOST_NETWORK_CONSTANTS_HPP_20100808 |
| 2 | +#define BOOST_NETWORK_CONSTANTS_HPP_20100808 |
| 3 | + |
| 4 | +// Copyright 2010 (C) Dean Michael Berris |
| 5 | +// Distributed under the Boost Software License, Version 1.0. |
| 6 | +// (See accompanying file LICENSE_1_0.txt or copy at |
| 7 | +// http://www.boost.org/LICENSE_1_0.txt) |
| 8 | + |
| 9 | +#include <boost/network/support/is_default_string.hpp> |
| 10 | +#include <boost/network/support/is_default_wstring.hpp> |
| 11 | +#include <boost/mpl/if.hpp> |
| 12 | + |
| 13 | +namespace boost { namespace network { |
| 14 | + |
| 15 | + namespace impl { |
| 16 | + template <class Tag> |
| 17 | + struct constants_narrow { |
| 18 | + |
| 19 | + static char const * crlf() { |
| 20 | + static char crlf_[] = { '\r', '\n', 0 }; |
| 21 | + return crlf_; |
| 22 | + } |
| 23 | + |
| 24 | + static char const * dot() { |
| 25 | + static char dot_[] = { '.', 0 }; |
| 26 | + return dot_; |
| 27 | + } |
| 28 | + |
| 29 | + static char const * http_slash() { |
| 30 | + static char http_slash_[] = { 'H', 'T', 'T', 'P', '/', 0 }; |
| 31 | + return http_slash_; |
| 32 | + } |
| 33 | + |
| 34 | + static char const * space() { |
| 35 | + static char space_[] = {' ', 0}; |
| 36 | + return space_; |
| 37 | + } |
| 38 | + |
| 39 | + static char const * slash() { |
| 40 | + static char slash_[] = {'/', 0}; |
| 41 | + return slash_; |
| 42 | + } |
| 43 | + |
| 44 | + static char const * host() { |
| 45 | + static char host_[] = {'H', 'o', 's', 't', 0}; |
| 46 | + return host_; |
| 47 | + } |
| 48 | + |
| 49 | + static char const * colon() { |
| 50 | + static char colon_[] = {':', 0}; |
| 51 | + return colon_; |
| 52 | + } |
| 53 | + |
| 54 | + static char const * accept() { |
| 55 | + static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0}; |
| 56 | + return accept_; |
| 57 | + } |
| 58 | + |
| 59 | + static char const * default_accept_mime() { |
| 60 | + static char mime_[] = { |
| 61 | + '*', '/', '*', 0 |
| 62 | + }; |
| 63 | + return mime_; |
| 64 | + } |
| 65 | + |
| 66 | + static char const * accept_encoding() { |
| 67 | + static char accept_encoding_[] = { |
| 68 | + 'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0 |
| 69 | + }; |
| 70 | + return accept_encoding_; |
| 71 | + } |
| 72 | + |
| 73 | + static char const * default_accept_encoding() { |
| 74 | + static char default_accept_encoding_[] = { |
| 75 | + 'i','d','e','n','t','i','t','y',';','q','=','1','.','0',',',' ','*',';','q','=','0',0 |
| 76 | + }; |
| 77 | + return default_accept_encoding_; |
| 78 | + } |
| 79 | + |
| 80 | + static char const * user_agent() { |
| 81 | + static char user_agent_[] = { |
| 82 | + 'U','s','e','r','-','A','g','e','n','t',0 |
| 83 | + }; |
| 84 | + return user_agent_; |
| 85 | + } |
| 86 | + |
| 87 | + static char const * cpp_netlib_slash() { |
| 88 | + static char cpp_netlib_slash_[] = { |
| 89 | + 'c','p','p','-','n','e','t','l','i','b','/',0 |
| 90 | + }; |
| 91 | + return cpp_netlib_slash_; |
| 92 | + } |
| 93 | + |
| 94 | + }; |
| 95 | + |
| 96 | + template <class Tag> |
| 97 | + struct constants_wide { |
| 98 | + }; |
| 99 | + } |
| 100 | + |
| 101 | + template <class Tag> |
| 102 | + struct constants : |
| 103 | + mpl::if_< |
| 104 | + is_default_string<Tag>, |
| 105 | + impl::constants_narrow<Tag>, |
| 106 | + typename mpl::if_< |
| 107 | + is_default_wstring<Tag>, |
| 108 | + impl::constants_wide<Tag>, |
| 109 | + unsupported_tag<Tag> |
| 110 | + >::type |
| 111 | + >::type |
| 112 | + {}; |
| 113 | + |
| 114 | +} // namespace network |
| 115 | + |
| 116 | +} // namespace boost |
| 117 | + |
| 118 | +#endif // BOOST_NETWORK_CONSTANTS_HPP_20100808 |
0 commit comments