|
| 1 | +#ifndef BOOST_NETWORK_CONSTANTS_HPP_20100808 |
| 2 | +#defineBOOST_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 | +namespaceboost {namespacenetwork { |
| 14 | + |
| 15 | +namespaceimpl { |
| 16 | +template<classTag> |
| 17 | +structconstants_narrow { |
| 18 | + |
| 19 | +staticcharconst *crlf() { |
| 20 | +staticchar crlf_[] = {'\r','\n',0 }; |
| 21 | +return crlf_; |
| 22 | + } |
| 23 | + |
| 24 | +staticcharconst *dot() { |
| 25 | +staticchar dot_[] = {'.',0 }; |
| 26 | +return dot_; |
| 27 | + } |
| 28 | + |
| 29 | +staticcharconst *http_slash() { |
| 30 | +staticchar http_slash_[] = {'H','T','T','P','/',0 }; |
| 31 | +return http_slash_; |
| 32 | + } |
| 33 | + |
| 34 | +staticcharconst *space() { |
| 35 | +staticchar space_[] = {'',0}; |
| 36 | +return space_; |
| 37 | + } |
| 38 | + |
| 39 | +staticcharconst *slash() { |
| 40 | +staticchar slash_[] = {'/',0}; |
| 41 | +return slash_; |
| 42 | + } |
| 43 | + |
| 44 | +staticcharconst *host() { |
| 45 | +staticchar host_[] = {'H','o','s','t',0}; |
| 46 | +return host_; |
| 47 | + } |
| 48 | + |
| 49 | +staticcharconst *colon() { |
| 50 | +staticchar colon_[] = {':',0}; |
| 51 | +return colon_; |
| 52 | + } |
| 53 | + |
| 54 | +staticcharconst *accept() { |
| 55 | +staticchar accept_[] = {'A','c','c','e','p','t',0}; |
| 56 | +return accept_; |
| 57 | + } |
| 58 | + |
| 59 | +staticcharconst *default_accept_mime() { |
| 60 | +staticchar mime_[] = { |
| 61 | +'*','/','*',0 |
| 62 | + }; |
| 63 | +return mime_; |
| 64 | + } |
| 65 | + |
| 66 | +staticcharconst *accept_encoding() { |
| 67 | +staticchar 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 | +staticcharconst *default_accept_encoding() { |
| 74 | +staticchar 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 | +staticcharconst *user_agent() { |
| 81 | +staticchar user_agent_[] = { |
| 82 | +'U','s','e','r','-','A','g','e','n','t',0 |
| 83 | + }; |
| 84 | +return user_agent_; |
| 85 | + } |
| 86 | + |
| 87 | +staticcharconst *cpp_netlib_slash() { |
| 88 | +staticchar 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<classTag> |
| 97 | +structconstants_wide { |
| 98 | + }; |
| 99 | + } |
| 100 | + |
| 101 | +template<classTag> |
| 102 | +structconstants : |
| 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 |