~ai.tron/armagetronad/0.4-winlibs-updated

« back to all changes in this revision

Viewing changes to boost/includes/boost/xpressive/traits/null_regex_traits.hpp

  • Committer: Manuel Moos
  • Date: 2013-08-10 16:21:05 UTC
  • mfrom: (118.1.64 winlibs-refactor)
  • Revision ID: z-man@users.sf.net-20130810162105-e6v55tas5si5gb3e
Updating boost to 1.53

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
///////////////////////////////////////////////////////////////////////////////
 
2
/// \file null_regex_traits.hpp
 
3
/// Contains the definition of the null_regex_traits\<\> template, which is a
 
4
/// stub regex traits implementation that can be used by static and dynamic
 
5
/// regexes for searching non-character data.
 
6
//
 
7
//  Copyright 2008 Eric Niebler. Distributed under the Boost
 
8
//  Software License, Version 1.0. (See accompanying file
 
9
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
10
 
 
11
#ifndef BOOST_XPRESSIVE_TRAITS_NULL_REGEX_TRAITS_HPP_EAN_10_04_2005
 
12
#define BOOST_XPRESSIVE_TRAITS_NULL_REGEX_TRAITS_HPP_EAN_10_04_2005
 
13
 
 
14
// MS compatible compilers support #pragma once
 
15
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
 
16
# pragma once
 
17
#endif
 
18
 
 
19
#include <vector>
 
20
#include <boost/assert.hpp>
 
21
#include <boost/mpl/assert.hpp>
 
22
#include <boost/xpressive/detail/detail_fwd.hpp>
 
23
#include <boost/xpressive/detail/utility/never_true.hpp>
 
24
#include <boost/xpressive/detail/utility/ignore_unused.hpp>
 
25
 
 
26
namespace boost { namespace xpressive
 
27
{
 
28
 
 
29
namespace detail
 
30
{
 
31
    struct not_a_locale {};
 
32
}
 
33
 
 
34
struct regex_traits_version_1_tag;
 
35
 
 
36
///////////////////////////////////////////////////////////////////////////////
 
37
// null_regex_traits
 
38
//
 
39
/// \brief stub regex_traits for non-char data
 
40
///
 
41
template<typename Elem>
 
42
struct null_regex_traits
 
43
{
 
44
    typedef Elem char_type;
 
45
    typedef std::vector<char_type> string_type;
 
46
    typedef detail::not_a_locale locale_type;
 
47
    typedef int char_class_type;
 
48
    typedef regex_traits_version_1_tag version_tag;
 
49
 
 
50
    /// Initialize a null_regex_traits object.
 
51
    ///
 
52
    null_regex_traits(locale_type = locale_type())
 
53
    {
 
54
    }
 
55
 
 
56
    /// Checks two null_regex_traits objects for equality
 
57
    ///
 
58
    /// \return true.
 
59
    bool operator ==(null_regex_traits<char_type> const &that) const
 
60
    {
 
61
        detail::ignore_unused(that);
 
62
        return true;
 
63
    }
 
64
 
 
65
    /// Checks two null_regex_traits objects for inequality
 
66
    ///
 
67
    /// \return false.
 
68
    bool operator !=(null_regex_traits<char_type> const &that) const
 
69
    {
 
70
        detail::ignore_unused(that);
 
71
        return false;
 
72
    }
 
73
 
 
74
    /// Convert a char to a Elem
 
75
    ///
 
76
    /// \param ch The source character.
 
77
    /// \return Elem(ch).
 
78
    char_type widen(char ch) const
 
79
    {
 
80
        return char_type(ch);
 
81
    }
 
82
 
 
83
    /// Returns a hash value for a Elem in the range [0, UCHAR_MAX]
 
84
    ///
 
85
    /// \param ch The source character.
 
86
    /// \return a value between 0 and UCHAR_MAX, inclusive.
 
87
    static unsigned char hash(char_type ch)
 
88
    {
 
89
        return static_cast<unsigned char>(ch);
 
90
    }
 
91
 
 
92
    /// No-op
 
93
    ///
 
94
    /// \param ch The source character.
 
95
    /// \return ch
 
96
    static char_type translate(char_type ch)
 
97
    {
 
98
        return ch;
 
99
    }
 
100
 
 
101
    /// No-op
 
102
    ///
 
103
    /// \param ch The source character.
 
104
    /// \return ch
 
105
    static char_type translate_nocase(char_type ch)
 
106
    {
 
107
        return ch;
 
108
    }
 
109
 
 
110
    /// Checks to see if a character is within a character range.
 
111
    ///
 
112
    /// \param first The bottom of the range, inclusive.
 
113
    /// \param last The top of the range, inclusive.
 
114
    /// \param ch The source character.
 
115
    /// \return first <= ch && ch <= last.
 
116
    static bool in_range(char_type first, char_type last, char_type ch)
 
117
    {
 
118
        return first <= ch && ch <= last;
 
119
    }
 
120
 
 
121
    /// Checks to see if a character is within a character range.
 
122
    ///
 
123
    /// \param first The bottom of the range, inclusive.
 
124
    /// \param last The top of the range, inclusive.
 
125
    /// \param ch The source character.
 
126
    /// \return first <= ch && ch <= last.
 
127
    /// \attention Since the null_regex_traits does not do case-folding,
 
128
    /// this function is equivalent to in_range().
 
129
    static bool in_range_nocase(char_type first, char_type last, char_type ch)
 
130
    {
 
131
        return first <= ch && ch <= last;
 
132
    }
 
133
 
 
134
    /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
 
135
    /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
 
136
    /// then v.transform(G1, G2) < v.transform(H1, H2).
 
137
    ///
 
138
    /// \attention Not currently used
 
139
    template<typename FwdIter>
 
140
    static string_type transform(FwdIter begin, FwdIter end)
 
141
    {
 
142
        return string_type(begin, end);
 
143
    }
 
144
 
 
145
    /// Returns a sort key for the character sequence designated by the iterator range [F1, F2)
 
146
    /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2)
 
147
    /// when character case is not considered then
 
148
    /// v.transform_primary(G1, G2) < v.transform_primary(H1, H2).
 
149
    ///
 
150
    /// \attention Not currently used
 
151
    template<typename FwdIter>
 
152
    static string_type transform_primary(FwdIter begin, FwdIter end)
 
153
    {
 
154
        return string_type(begin, end);
 
155
    }
 
156
 
 
157
    /// Returns a sequence of characters that represents the collating element
 
158
    /// consisting of the character sequence designated by the iterator range [F1, F2).
 
159
    /// Returns an empty string if the character sequence is not a valid collating element.
 
160
    ///
 
161
    /// \attention Not currently used
 
162
    template<typename FwdIter>
 
163
    static string_type lookup_collatename(FwdIter begin, FwdIter end)
 
164
    {
 
165
        detail::ignore_unused(begin);
 
166
        detail::ignore_unused(end);
 
167
        return string_type();
 
168
    }
 
169
 
 
170
    /// The null_regex_traits does not have character classifications, so lookup_classname()
 
171
    /// is unused.
 
172
    ///
 
173
    /// \param begin not used
 
174
    /// \param end not used
 
175
    /// \param icase not used
 
176
    /// \return static_cast\<char_class_type\>(0)
 
177
    template<typename FwdIter>
 
178
    static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase)
 
179
    {
 
180
        detail::ignore_unused(begin);
 
181
        detail::ignore_unused(end);
 
182
        detail::ignore_unused(icase);
 
183
        return 0;
 
184
    }
 
185
 
 
186
    /// The null_regex_traits does not have character classifications, so isctype()
 
187
    /// is unused.
 
188
    ///
 
189
    /// \param ch not used
 
190
    /// \param mask not used
 
191
    /// \return false
 
192
    static bool isctype(char_type ch, char_class_type mask)
 
193
    {
 
194
        detail::ignore_unused(ch);
 
195
        detail::ignore_unused(mask);
 
196
        return false;
 
197
    }
 
198
 
 
199
    /// The null_regex_traits recognizes no elements as digits, so value() is unused.
 
200
    ///
 
201
    /// \param ch not used
 
202
    /// \param radix not used
 
203
    /// \return -1
 
204
    static int value(char_type ch, int radix)
 
205
    {
 
206
        detail::ignore_unused(ch);
 
207
        detail::ignore_unused(radix);
 
208
        return -1;
 
209
    }
 
210
 
 
211
    /// Not used
 
212
    ///
 
213
    /// \param loc not used
 
214
    /// \return loc
 
215
    static locale_type imbue(locale_type loc)
 
216
    {
 
217
        return loc;
 
218
    }
 
219
 
 
220
    /// Returns locale_type().
 
221
    ///
 
222
    /// \return locale_type()
 
223
    static locale_type getloc()
 
224
    {
 
225
        return locale_type();
 
226
    }
 
227
};
 
228
 
 
229
}}
 
230
 
 
231
#endif