| Report problems to ATLAS LXR Team (with time and IP address indicated) |
|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
||||
|
||||||
| Links to LXR source navigation pages for stable releases | [ 12.*.* ] [ 13.*.* ] [ 14.*.* ] | |||||
001 /////////////////////////////////////////////////////////////////////////////// 002 /// \file null_regex_traits.hpp 003 /// Contains the definition of the null_regex_traits\<\> template, which is a 004 /// stub regex traits implementation that can be used by static and dynamic 005 /// regexes for searching non-character data. 006 // 007 // Copyright 2004 Eric Niebler. Distributed under the Boost 008 // Software License, Version 1.0. (See accompanying file 009 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 010 011 #ifndef BOOST_XPRESSIVE_TRAITS_NULL_REGEX_TRAITS_HPP_EAN_10_04_2005 012 #define BOOST_XPRESSIVE_TRAITS_NULL_REGEX_TRAITS_HPP_EAN_10_04_2005 013 014 // MS compatible compilers support #pragma once 015 #if defined(_MSC_VER) && (_MSC_VER >= 1020) 016 # pragma once 017 #endif 018 019 #include <vector> 020 #include <boost/assert.hpp> 021 #include <boost/mpl/assert.hpp> 022 #include <boost/xpressive/detail/detail_fwd.hpp> 023 #include <boost/xpressive/detail/utility/never_true.hpp> 024 #include <boost/xpressive/detail/utility/ignore_unused.hpp> 025 026 namespace boost { namespace xpressive 027 { 028 029 namespace detail 030 { 031 struct not_a_locale {}; 032 } 033 034 struct regex_traits_version_1_tag; 035 036 /////////////////////////////////////////////////////////////////////////////// 037 // null_regex_traits 038 // 039 /// \brief stub regex_traits for non-char data 040 /// 041 template<typename Elem> 042 struct null_regex_traits 043 { 044 typedef Elem char_type; 045 typedef std::vector<char_type> string_type; 046 typedef detail::not_a_locale locale_type; 047 typedef int char_class_type; 048 typedef regex_traits_version_1_tag version_tag; 049 050 /// Initialize a null_regex_traits object. 051 /// 052 null_regex_traits(locale_type = locale_type()) 053 { 054 } 055 056 /// Checks two null_regex_traits objects for equality 057 /// 058 /// \return true. 059 bool operator ==(null_regex_traits<char_type> const &that) const 060 { 061 detail::ignore_unused(&that); 062 return true; 063 } 064 065 /// Checks two null_regex_traits objects for inequality 066 /// 067 /// \return false. 068 bool operator !=(null_regex_traits<char_type> const &that) const 069 { 070 detail::ignore_unused(&that); 071 return false; 072 } 073 074 /// Convert a char to a Elem 075 /// 076 /// \param ch The source character. 077 /// \return Elem(ch). 078 char_type widen(char ch) const 079 { 080 //BOOST_MPL_ASSERT((detail::never_true<char_type>)); 081 BOOST_ASSERT(false); 082 return char_type(ch); 083 } 084 085 /// Returns a hash value for a Elem in the range [0, UCHAR_MAX] 086 /// 087 /// \param ch The source character. 088 /// \return a value between 0 and UCHAR_MAX, inclusive. 089 static unsigned char hash(char_type ch) 090 { 091 return static_cast<unsigned char>(ch); 092 } 093 094 /// No-op 095 /// 096 /// \param ch The source character. 097 /// \return ch 098 static char_type translate(char_type ch) 099 { 100 return ch; 101 } 102 103 /// No-op 104 /// 105 /// \param ch The source character. 106 /// \return ch 107 static char_type translate_nocase(char_type ch) 108 { 109 return ch; 110 } 111 112 /// Checks to see if a character is within a character range. 113 /// 114 /// \param first The bottom of the range, inclusive. 115 /// \param last The top of the range, inclusive. 116 /// \param ch The source character. 117 /// \return first <= ch && ch <= last. 118 static bool in_range(char_type first, char_type last, char_type ch) 119 { 120 return first <= ch && ch <= last; 121 } 122 123 /// Checks to see if a character is within a character range. 124 /// 125 /// \param first The bottom of the range, inclusive. 126 /// \param last The top of the range, inclusive. 127 /// \param ch The source character. 128 /// \return first <= ch && ch <= last. 129 /// \attention Since the null_regex_traits does not do case-folding, 130 /// this function is equivalent to in_range(). 131 static bool in_range_nocase(char_type first, char_type last, char_type ch) 132 { 133 return first <= ch && ch <= last; 134 } 135 136 /// Returns a sort key for the character sequence designated by the iterator range [F1, F2) 137 /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2) 138 /// then v.transform(G1, G2) < v.transform(H1, H2). 139 /// 140 /// \attention Not used in xpressive 1.0 141 template<typename FwdIter> 142 static string_type transform(FwdIter begin, FwdIter end) 143 { 144 return string_type(begin, end); 145 } 146 147 /// Returns a sort key for the character sequence designated by the iterator range [F1, F2) 148 /// such that if the character sequence [G1, G2) sorts before the character sequence [H1, H2) 149 /// when character case is not considered then 150 /// v.transform_primary(G1, G2) < v.transform_primary(H1, H2). 151 /// 152 /// \attention Not used in xpressive 1.0 153 template<typename FwdIter> 154 static string_type transform_primary(FwdIter begin, FwdIter end) 155 { 156 return string_type(begin, end); 157 } 158 159 /// Returns a sequence of characters that represents the collating element 160 /// consisting of the character sequence designated by the iterator range [F1, F2). 161 /// Returns an empty string if the character sequence is not a valid collating element. 162 /// 163 /// \attention Not used in xpressive 1.0 164 template<typename FwdIter> 165 static string_type lookup_collatename(FwdIter begin, FwdIter end) 166 { 167 detail::ignore_unused(&begin); 168 detail::ignore_unused(&end); 169 return string_type(); 170 } 171 172 /// The null_regex_traits does not have character classifications, so lookup_classname() 173 /// is unused. 174 /// 175 /// \param begin not used 176 /// \param end not used 177 /// \param icase not used 178 /// \return static_cast\<char_class_type\>(0) 179 template<typename FwdIter> 180 static char_class_type lookup_classname(FwdIter begin, FwdIter end, bool icase) 181 { 182 detail::ignore_unused(&begin); 183 detail::ignore_unused(&end); 184 detail::ignore_unused(&icase); 185 return 0; 186 } 187 188 /// The null_regex_traits does not have character classifications, so isctype() 189 /// is unused. 190 /// 191 /// \param ch not used 192 /// \param mask not used 193 /// \return false 194 static bool isctype(char_type ch, char_class_type mask) 195 { 196 detail::ignore_unused(&ch); 197 detail::ignore_unused(&mask); 198 return false; 199 } 200 201 /// The null_regex_traits recognizes no elements as digits, so value() is unused. 202 /// 203 /// \param ch not used 204 /// \param radix not used 205 /// \return -1 206 static int value(char_type ch, int radix) 207 { 208 detail::ignore_unused(&ch); 209 detail::ignore_unused(&radix); 210 return -1; 211 } 212 213 /// Not used 214 /// 215 /// \param loc not used 216 /// \return loc 217 static locale_type imbue(locale_type loc) 218 { 219 return loc; 220 } 221 222 /// Returns locale_type(). 223 /// 224 /// \return locale_type() 225 static locale_type getloc() 226 { 227 return locale_type(); 228 } 229 }; 230 231 }} 232 233 #endif
| [ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems | |
| This page was automatically generated by the LXR engine. |
|