]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/spirit/include/boost/spirit/home/x3/char/char.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / x3 / char / char.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2001-2014 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6==============================================================================*/
7#if !defined(BOOST_SPIRIT_X3_CHAR_APRIL_16_2006_1051AM)
8#define BOOST_SPIRIT_X3_CHAR_APRIL_16_2006_1051AM
9
10#include <boost/spirit/home/x3/char/any_char.hpp>
11#include <boost/spirit/home/support/char_encoding/ascii.hpp>
12#include <boost/spirit/home/support/char_encoding/iso8859_1.hpp>
13#include <boost/spirit/home/support/char_encoding/standard.hpp>
14#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
15
16namespace boost { namespace spirit { namespace x3
17{
18 namespace standard
19 {
20 typedef any_char<char_encoding::standard> char_type;
21 auto const char_ = char_type{};
22
23 inline literal_char<char_encoding::standard, unused_type>
24 lit(char ch)
25 {
26 return { ch };
27 }
28
29 inline literal_char<char_encoding::standard, unused_type>
30 lit(wchar_t ch)
31 {
32 return { ch };
33 }
34
35 }
36
37 using standard::char_type;
38 using standard::char_;
39 using standard::lit;
40
41 namespace standard_wide
42 {
43 typedef any_char<char_encoding::standard_wide> char_type;
44 auto const char_ = char_type{};
45
46 inline literal_char<char_encoding::standard_wide, unused_type>
47 lit(wchar_t ch)
48 {
49 return { ch };
50 }
51 }
52
53 namespace ascii
54 {
55 typedef any_char<char_encoding::ascii> char_type;
56 auto const char_ = char_type{};
57
58 inline literal_char<char_encoding::ascii, unused_type>
59 lit(char ch)
60 {
61 return { ch };
62 }
63
64 inline literal_char<char_encoding::ascii, unused_type>
65 lit(wchar_t ch)
66 {
67 return { ch };
68 }
69 }
70
71 namespace iso8859_1
72 {
73 typedef any_char<char_encoding::iso8859_1> char_type;
74 auto const char_ = char_type{};
75
76 inline literal_char<char_encoding::iso8859_1, unused_type>
77 lit(char ch)
78 {
79 return { ch };
80 }
81
82 inline literal_char<char_encoding::iso8859_1, unused_type>
83 lit(wchar_t ch)
84 {
85 return { ch };
86 }
87 }
88
89 namespace extension
90 {
91 template <>
92 struct as_parser<char>
93 {
94 typedef literal_char<
95 char_encoding::standard, unused_type>
96 type;
97
98 typedef type value_type;
99
100 static type call(char ch)
101 {
102 return { ch };
103 }
104 };
105
106 template <>
107 struct as_parser<wchar_t>
108 {
109 typedef literal_char<
110 char_encoding::standard_wide, unused_type>
111 type;
112
113 typedef type value_type;
114
115 static type call(wchar_t ch)
116 {
117 return { ch };
118 }
119 };
120
121 template <>
122 struct as_parser<char [2]>
123 {
124 typedef literal_char<
125 char_encoding::standard, unused_type>
126 type;
127
128 typedef type value_type;
129
130 static type call(char const ch[])
131 {
132 return { ch[0] };
133 }
134 };
135
136 template <>
137 struct as_parser<wchar_t [2]>
138 {
139 typedef literal_char<
140 char_encoding::standard_wide, unused_type>
141 type;
142
143 typedef type value_type;
144
145 static type call(wchar_t const ch[] )
146 {
147 return { ch[0] };
148 }
149 };
150
151 }
152
153}}}
154
155#endif