1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/regex/concepts.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,870 @@
1.4 +/*
1.5 + *
1.6 + * Copyright (c) 2004
1.7 + * John Maddock
1.8 + *
1.9 + * Use, modification and distribution are subject to the
1.10 + * Boost Software License, Version 1.0. (See accompanying file
1.11 + * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.12 + *
1.13 + */
1.14 +
1.15 + /*
1.16 + * LOCATION: see http://www.boost.org for most recent version.
1.17 + * FILE concepts.hpp
1.18 + * VERSION see <boost/version.hpp>
1.19 + * DESCRIPTION: Declares regular expression concepts.
1.20 + */
1.21 +
1.22 +#ifndef BOOST_REGEX_CONCEPTS_HPP_INCLUDED
1.23 +#define BOOST_REGEX_CONCEPTS_HPP_INCLUDED
1.24 +
1.25 +#include <boost/concept_archetype.hpp>
1.26 +#include <boost/concept_check.hpp>
1.27 +#include <boost/type_traits/is_enum.hpp>
1.28 +#include <boost/type_traits/is_base_and_derived.hpp>
1.29 +#include <boost/static_assert.hpp>
1.30 +#ifndef BOOST_TEST_TR1_REGEX
1.31 +#include <boost/regex.hpp>
1.32 +#endif
1.33 +#include <bitset>
1.34 +#include <vector>
1.35 +#include <iostream>
1.36 +
1.37 +namespace boost{
1.38 +
1.39 +//
1.40 +// bitmask_archetype:
1.41 +// this can be either an integer type, an enum, or a std::bitset,
1.42 +// we use the latter as the architype as it offers the "strictest"
1.43 +// of the possible interfaces:
1.44 +//
1.45 +typedef std::bitset<512> bitmask_archetype;
1.46 +//
1.47 +// char_architype:
1.48 +// A strict model for the character type interface.
1.49 +//
1.50 +struct char_architype
1.51 +{
1.52 + // default constructable:
1.53 + char_architype();
1.54 + // copy constructable / assignable:
1.55 + char_architype(const char_architype&);
1.56 + char_architype& operator=(const char_architype&);
1.57 + // constructable from an integral value:
1.58 + char_architype(unsigned long val);
1.59 + // comparable:
1.60 + bool operator==(const char_architype&)const;
1.61 + bool operator!=(const char_architype&)const;
1.62 + bool operator<(const char_architype&)const;
1.63 + bool operator<=(const char_architype&)const;
1.64 + bool operator>=(const char_architype&)const;
1.65 + bool operator>(const char_architype&)const;
1.66 + // conversion to integral type:
1.67 + operator long()const;
1.68 +};
1.69 +//
1.70 +// char_architype can not be used with basic_string:
1.71 +//
1.72 +} // namespace boost
1.73 +namespace std{
1.74 + template<> struct char_traits<boost::char_architype>
1.75 + {
1.76 + // The intent is that this template is not instantiated,
1.77 + // but this typedef gives us a chance of compilation in
1.78 + // case it is:
1.79 + typedef boost::char_architype char_type;
1.80 + };
1.81 +}
1.82 +namespace boost{
1.83 +//
1.84 +// regex_traits_architype:
1.85 +// A strict interpretation of the regular expression traits class requirements.
1.86 +//
1.87 +template <class charT>
1.88 +struct regex_traits_architype
1.89 +{
1.90 +public:
1.91 + regex_traits_architype();
1.92 + typedef charT char_type;
1.93 + typedef std::size_t size_type;
1.94 + typedef std::vector<char_type> string_type;
1.95 + typedef copy_constructible_archetype<assignable_archetype<> > locale_type;
1.96 + typedef bitmask_archetype char_class_type;
1.97 +
1.98 + static size_type length(const char_type* ) { return 0; }
1.99 +
1.100 + charT translate(charT ) const { return charT(); }
1.101 + charT translate_nocase(charT ) const { return static_object<charT>::get(); }
1.102 +
1.103 + template <class ForwardIterator>
1.104 + string_type transform(ForwardIterator , ForwardIterator ) const
1.105 + { return static_object<string_type>::get(); }
1.106 + template <class ForwardIterator>
1.107 + string_type transform_primary(ForwardIterator , ForwardIterator ) const
1.108 + { return static_object<string_type>::get(); }
1.109 +
1.110 + template <class ForwardIterator>
1.111 + char_class_type lookup_classname(ForwardIterator , ForwardIterator ) const
1.112 + { return static_object<char_class_type>::get(); }
1.113 + template <class ForwardIterator>
1.114 + string_type lookup_collatename(ForwardIterator , ForwardIterator ) const
1.115 + { return static_object<string_type>::get(); }
1.116 +
1.117 + bool isctype(charT, char_class_type) const
1.118 + { return false; }
1.119 + int value(charT, int) const
1.120 + { return 0; }
1.121 +
1.122 + locale_type imbue(locale_type l)
1.123 + { return l; }
1.124 + locale_type getloc()const
1.125 + { return static_object<locale_type>::get(); }
1.126 +
1.127 +private:
1.128 + // this type is not copyable:
1.129 + regex_traits_architype(const regex_traits_architype&);
1.130 + regex_traits_architype& operator=(const regex_traits_architype&);
1.131 +};
1.132 +
1.133 +//
1.134 +// alter this to std::tr1, to test a std implementation:
1.135 +//
1.136 +#ifndef BOOST_TEST_TR1_REGEX
1.137 +namespace global_regex_namespace = ::boost;
1.138 +#else
1.139 +namespace global_regex_namespace = ::std::tr1;
1.140 +#endif
1.141 +
1.142 +template <class Bitmask>
1.143 +struct BitmaskConcept
1.144 +{
1.145 + void constraints()
1.146 + {
1.147 + function_requires<CopyConstructibleConcept<Bitmask> >();
1.148 + function_requires<AssignableConcept<Bitmask> >();
1.149 +
1.150 + m_mask1 = m_mask2 | m_mask3;
1.151 + m_mask1 = m_mask2 & m_mask3;
1.152 + m_mask1 = m_mask2 ^ m_mask3;
1.153 +
1.154 + m_mask1 = ~m_mask2;
1.155 +
1.156 + m_mask1 |= m_mask2;
1.157 + m_mask1 &= m_mask2;
1.158 + m_mask1 ^= m_mask2;
1.159 + }
1.160 + Bitmask m_mask1, m_mask2, m_mask3;
1.161 +};
1.162 +
1.163 +template <class traits>
1.164 +struct RegexTraitsConcept
1.165 +{
1.166 + RegexTraitsConcept();
1.167 + // required typedefs:
1.168 + typedef typename traits::char_type char_type;
1.169 + typedef typename traits::size_type size_type;
1.170 + typedef typename traits::string_type string_type;
1.171 + typedef typename traits::locale_type locale_type;
1.172 + typedef typename traits::char_class_type char_class_type;
1.173 +
1.174 + void constraints()
1.175 + {
1.176 + function_requires<UnsignedIntegerConcept<size_type> >();
1.177 + function_requires<RandomAccessContainerConcept<string_type> >();
1.178 + function_requires<DefaultConstructibleConcept<locale_type> >();
1.179 + function_requires<CopyConstructibleConcept<locale_type> >();
1.180 + function_requires<AssignableConcept<locale_type> >();
1.181 + function_requires<BitmaskConcept<char_class_type> >();
1.182 +
1.183 + size_type n = traits::length(m_pointer);
1.184 + ignore_unused_variable_warning(n);
1.185 +
1.186 + char_type c = m_ctraits.translate(m_char);
1.187 + ignore_unused_variable_warning(c);
1.188 + c = m_ctraits.translate_nocase(m_char);
1.189 +
1.190 + //string_type::foobar bar;
1.191 + string_type s1 = m_ctraits.transform(m_pointer, m_pointer);
1.192 + ignore_unused_variable_warning(s1);
1.193 +
1.194 + string_type s2 = m_ctraits.transform_primary(m_pointer, m_pointer);
1.195 + ignore_unused_variable_warning(s2);
1.196 +
1.197 + char_class_type cc = m_ctraits.lookup_classname(m_pointer, m_pointer);
1.198 + ignore_unused_variable_warning(cc);
1.199 +
1.200 + string_type s3 = m_ctraits.lookup_collatename(m_pointer, m_pointer);
1.201 + ignore_unused_variable_warning(s3);
1.202 +
1.203 + bool b = m_ctraits.isctype(m_char, cc);
1.204 + ignore_unused_variable_warning(b);
1.205 +
1.206 + int v = m_ctraits.value(m_char, 16);
1.207 + ignore_unused_variable_warning(v);
1.208 +
1.209 + locale_type l(m_ctraits.getloc());
1.210 + m_traits.imbue(l);
1.211 + ignore_unused_variable_warning(l);
1.212 + }
1.213 + traits m_traits;
1.214 + const traits m_ctraits;
1.215 + const char_type* m_pointer;
1.216 + char_type m_char;
1.217 +private:
1.218 + RegexTraitsConcept& operator=(RegexTraitsConcept&);
1.219 +};
1.220 +
1.221 +//
1.222 +// helper class to compute what traits class a regular expression type is using:
1.223 +//
1.224 +template <class Regex>
1.225 +struct regex_traits_computer;
1.226 +
1.227 +template <class charT, class traits>
1.228 +struct regex_traits_computer< global_regex_namespace::basic_regex<charT, traits> >
1.229 +{
1.230 + typedef traits type;
1.231 +};
1.232 +
1.233 +//
1.234 +// BaseRegexConcept does not test anything dependent on basic_string,
1.235 +// in case our charT does not have an associated char_traits:
1.236 +//
1.237 +template <class Regex>
1.238 +struct BaseRegexConcept
1.239 +{
1.240 + typedef typename Regex::value_type value_type;
1.241 + typedef typename Regex::size_type size_type;
1.242 + typedef typename Regex::flag_type flag_type;
1.243 + typedef typename Regex::locale_type locale_type;
1.244 + typedef input_iterator_archetype<value_type> input_iterator_type;
1.245 +
1.246 + // derived test types:
1.247 + typedef const value_type* pointer_type;
1.248 + typedef bidirectional_iterator_archetype<value_type> BidiIterator;
1.249 + typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
1.250 + typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
1.251 + typedef output_iterator_archetype<value_type> OutIterator;
1.252 + typedef typename regex_traits_computer<Regex>::type traits_type;
1.253 + typedef global_regex_namespace::regex_iterator<BidiIterator, value_type, traits_type> regex_iterator_type;
1.254 + typedef global_regex_namespace::regex_token_iterator<BidiIterator, value_type, traits_type> regex_token_iterator_type;
1.255 +
1.256 + void global_constraints()
1.257 + {
1.258 + //
1.259 + // test non-template components:
1.260 + //
1.261 + function_requires<BitmaskConcept<global_regex_namespace::regex_constants::syntax_option_type> >();
1.262 + global_regex_namespace::regex_constants::syntax_option_type opts
1.263 + = global_regex_namespace::regex_constants::icase
1.264 + | global_regex_namespace::regex_constants::nosubs
1.265 + | global_regex_namespace::regex_constants::optimize
1.266 + | global_regex_namespace::regex_constants::collate
1.267 + | global_regex_namespace::regex_constants::ECMAScript
1.268 + | global_regex_namespace::regex_constants::basic
1.269 + | global_regex_namespace::regex_constants::extended
1.270 + | global_regex_namespace::regex_constants::awk
1.271 + | global_regex_namespace::regex_constants::grep
1.272 + | global_regex_namespace::regex_constants::egrep;
1.273 + ignore_unused_variable_warning(opts);
1.274 +
1.275 + function_requires<BitmaskConcept<global_regex_namespace::regex_constants::match_flag_type> >();
1.276 + global_regex_namespace::regex_constants::match_flag_type mopts
1.277 + = global_regex_namespace::regex_constants::match_default
1.278 + | global_regex_namespace::regex_constants::match_not_bol
1.279 + | global_regex_namespace::regex_constants::match_not_eol
1.280 + | global_regex_namespace::regex_constants::match_not_bow
1.281 + | global_regex_namespace::regex_constants::match_not_eow
1.282 + | global_regex_namespace::regex_constants::match_any
1.283 + | global_regex_namespace::regex_constants::match_not_null
1.284 + | global_regex_namespace::regex_constants::match_continuous
1.285 + | global_regex_namespace::regex_constants::match_prev_avail
1.286 + | global_regex_namespace::regex_constants::format_default
1.287 + | global_regex_namespace::regex_constants::format_sed
1.288 + | global_regex_namespace::regex_constants::format_no_copy
1.289 + | global_regex_namespace::regex_constants::format_first_only;
1.290 + ignore_unused_variable_warning(mopts);
1.291 +
1.292 + BOOST_STATIC_ASSERT((::boost::is_enum<global_regex_namespace::regex_constants::error_type>::value));
1.293 + global_regex_namespace::regex_constants::error_type e1 = global_regex_namespace::regex_constants::error_collate;
1.294 + ignore_unused_variable_warning(e1);
1.295 + e1 = global_regex_namespace::regex_constants::error_ctype;
1.296 + ignore_unused_variable_warning(e1);
1.297 + e1 = global_regex_namespace::regex_constants::error_escape;
1.298 + ignore_unused_variable_warning(e1);
1.299 + e1 = global_regex_namespace::regex_constants::error_backref;
1.300 + ignore_unused_variable_warning(e1);
1.301 + e1 = global_regex_namespace::regex_constants::error_brack;
1.302 + ignore_unused_variable_warning(e1);
1.303 + e1 = global_regex_namespace::regex_constants::error_paren;
1.304 + ignore_unused_variable_warning(e1);
1.305 + e1 = global_regex_namespace::regex_constants::error_brace;
1.306 + ignore_unused_variable_warning(e1);
1.307 + e1 = global_regex_namespace::regex_constants::error_badbrace;
1.308 + ignore_unused_variable_warning(e1);
1.309 + e1 = global_regex_namespace::regex_constants::error_range;
1.310 + ignore_unused_variable_warning(e1);
1.311 + e1 = global_regex_namespace::regex_constants::error_space;
1.312 + ignore_unused_variable_warning(e1);
1.313 + e1 = global_regex_namespace::regex_constants::error_badrepeat;
1.314 + ignore_unused_variable_warning(e1);
1.315 + e1 = global_regex_namespace::regex_constants::error_complexity;
1.316 + ignore_unused_variable_warning(e1);
1.317 + e1 = global_regex_namespace::regex_constants::error_stack;
1.318 + ignore_unused_variable_warning(e1);
1.319 +
1.320 + BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::runtime_error, global_regex_namespace::regex_error>::value ));
1.321 + const global_regex_namespace::regex_error except(e1);
1.322 + e1 = except.code();
1.323 +
1.324 + typedef typename Regex::value_type value_type;
1.325 + function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
1.326 + function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
1.327 + }
1.328 + void constraints()
1.329 + {
1.330 + global_constraints();
1.331 +
1.332 + BOOST_STATIC_ASSERT((::boost::is_same< flag_type, global_regex_namespace::regex_constants::syntax_option_type>::value));
1.333 + flag_type opts
1.334 + = Regex::icase
1.335 + | Regex::nosubs
1.336 + | Regex::optimize
1.337 + | Regex::collate
1.338 + | Regex::ECMAScript
1.339 + | Regex::basic
1.340 + | Regex::extended
1.341 + | Regex::awk
1.342 + | Regex::grep
1.343 + | Regex::egrep;
1.344 + ignore_unused_variable_warning(opts);
1.345 +
1.346 + function_requires<DefaultConstructibleConcept<Regex> >();
1.347 + function_requires<CopyConstructibleConcept<Regex> >();
1.348 +
1.349 + // Regex constructors:
1.350 + Regex e1(m_pointer);
1.351 + ignore_unused_variable_warning(e1);
1.352 + Regex e2(m_pointer, m_flags);
1.353 + ignore_unused_variable_warning(e2);
1.354 + Regex e3(m_pointer, m_size, m_flags);
1.355 + ignore_unused_variable_warning(e3);
1.356 + Regex e4(in1, in2);
1.357 + ignore_unused_variable_warning(e4);
1.358 + Regex e5(in1, in2, m_flags);
1.359 + ignore_unused_variable_warning(e5);
1.360 +
1.361 + // assign etc:
1.362 + Regex e;
1.363 + e = m_pointer;
1.364 + e = e1;
1.365 + e.assign(e1);
1.366 + e.assign(m_pointer);
1.367 + e.assign(m_pointer, m_flags);
1.368 + e.assign(m_pointer, m_size, m_flags);
1.369 + e.assign(in1, in2);
1.370 + e.assign(in1, in2, m_flags);
1.371 +
1.372 + // access:
1.373 + const Regex ce;
1.374 + bool b = ce.empty();
1.375 + ignore_unused_variable_warning(b);
1.376 + size_type i = ce.mark_count();
1.377 + ignore_unused_variable_warning(i);
1.378 + m_flags = ce.flags();
1.379 + e.imbue(ce.getloc());
1.380 + e.swap(e1);
1.381 +
1.382 + global_regex_namespace::swap(e, e1);
1.383 +
1.384 + // sub_match:
1.385 + BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::pair<BidiIterator, BidiIterator>, sub_match_type>::value));
1.386 + typedef typename sub_match_type::value_type sub_value_type;
1.387 + typedef typename sub_match_type::difference_type sub_diff_type;
1.388 + typedef typename sub_match_type::iterator sub_iter_type;
1.389 + BOOST_STATIC_ASSERT((::boost::is_same<sub_value_type, value_type>::value));
1.390 + BOOST_STATIC_ASSERT((::boost::is_same<sub_iter_type, BidiIterator>::value));
1.391 + b = m_sub.matched;
1.392 + ignore_unused_variable_warning(b);
1.393 + BidiIterator bi = m_sub.first;
1.394 + ignore_unused_variable_warning(bi);
1.395 + bi = m_sub.second;
1.396 + ignore_unused_variable_warning(bi);
1.397 + sub_diff_type diff = m_sub.length();
1.398 + ignore_unused_variable_warning(diff);
1.399 + // match_results tests:
1.400 + typedef typename match_results_type::value_type mr_value_type;
1.401 + typedef typename match_results_type::const_reference mr_const_reference;
1.402 + typedef typename match_results_type::reference mr_reference;
1.403 + typedef typename match_results_type::const_iterator mr_const_iterator;
1.404 + typedef typename match_results_type::iterator mr_iterator;
1.405 + typedef typename match_results_type::difference_type mr_difference_type;
1.406 + typedef typename match_results_type::size_type mr_size_type;
1.407 + typedef typename match_results_type::allocator_type mr_allocator_type;
1.408 + typedef typename match_results_type::char_type mr_char_type;
1.409 + typedef typename match_results_type::string_type mr_string_type;
1.410 +
1.411 + match_results_type m1;
1.412 + mr_allocator_type at;
1.413 + match_results_type m2(at);
1.414 + match_results_type m3(m1);
1.415 + m1 = m2;
1.416 +
1.417 + int ival = 0;
1.418 +
1.419 + mr_size_type mrs = m_cresults.size();
1.420 + ignore_unused_variable_warning(mrs);
1.421 + mrs = m_cresults.max_size();
1.422 + ignore_unused_variable_warning(mrs);
1.423 + b = m_cresults.empty();
1.424 + ignore_unused_variable_warning(b);
1.425 + mr_difference_type mrd = m_cresults.length();
1.426 + ignore_unused_variable_warning(mrd);
1.427 + mrd = m_cresults.length(ival);
1.428 + ignore_unused_variable_warning(mrd);
1.429 + mrd = m_cresults.position();
1.430 + ignore_unused_variable_warning(mrd);
1.431 + mrd = m_cresults.position(mrs);
1.432 + ignore_unused_variable_warning(mrd);
1.433 +
1.434 + mr_const_reference mrcr = m_cresults[ival];
1.435 + ignore_unused_variable_warning(mrcr);
1.436 + mr_const_reference mrcr2 = m_cresults.prefix();
1.437 + ignore_unused_variable_warning(mrcr2);
1.438 + mr_const_reference mrcr3 = m_cresults.suffix();
1.439 + ignore_unused_variable_warning(mrcr3);
1.440 + mr_const_iterator mrci = m_cresults.begin();
1.441 + ignore_unused_variable_warning(mrci);
1.442 + mrci = m_cresults.end();
1.443 + ignore_unused_variable_warning(mrci);
1.444 +
1.445 + mr_allocator_type at2 = m_cresults.get_allocator();
1.446 + m_results.swap(m_results);
1.447 + global_regex_namespace::swap(m_results, m_results);
1.448 +
1.449 + // regex_match:
1.450 + b = global_regex_namespace::regex_match(m_in, m_in, m_results, e);
1.451 + ignore_unused_variable_warning(b);
1.452 + b = global_regex_namespace::regex_match(m_in, m_in, m_results, e, m_mft);
1.453 + ignore_unused_variable_warning(b);
1.454 + b = global_regex_namespace::regex_match(m_in, m_in, e);
1.455 + ignore_unused_variable_warning(b);
1.456 + b = global_regex_namespace::regex_match(m_in, m_in, e, m_mft);
1.457 + ignore_unused_variable_warning(b);
1.458 + b = global_regex_namespace::regex_match(m_pointer, m_pmatch, e);
1.459 + ignore_unused_variable_warning(b);
1.460 + b = global_regex_namespace::regex_match(m_pointer, m_pmatch, e, m_mft);
1.461 + ignore_unused_variable_warning(b);
1.462 + b = global_regex_namespace::regex_match(m_pointer, e);
1.463 + ignore_unused_variable_warning(b);
1.464 + b = global_regex_namespace::regex_match(m_pointer, e, m_mft);
1.465 + ignore_unused_variable_warning(b);
1.466 + // regex_search:
1.467 + b = global_regex_namespace::regex_search(m_in, m_in, m_results, e);
1.468 + ignore_unused_variable_warning(b);
1.469 + b = global_regex_namespace::regex_search(m_in, m_in, m_results, e, m_mft);
1.470 + ignore_unused_variable_warning(b);
1.471 + b = global_regex_namespace::regex_search(m_in, m_in, e);
1.472 + ignore_unused_variable_warning(b);
1.473 + b = global_regex_namespace::regex_search(m_in, m_in, e, m_mft);
1.474 + ignore_unused_variable_warning(b);
1.475 + b = global_regex_namespace::regex_search(m_pointer, m_pmatch, e);
1.476 + ignore_unused_variable_warning(b);
1.477 + b = global_regex_namespace::regex_search(m_pointer, m_pmatch, e, m_mft);
1.478 + ignore_unused_variable_warning(b);
1.479 + b = global_regex_namespace::regex_search(m_pointer, e);
1.480 + ignore_unused_variable_warning(b);
1.481 + b = global_regex_namespace::regex_search(m_pointer, e, m_mft);
1.482 + ignore_unused_variable_warning(b);
1.483 +
1.484 + // regex_iterator:
1.485 + typedef typename regex_iterator_type::regex_type rit_regex_type;
1.486 + typedef typename regex_iterator_type::value_type rit_value_type;
1.487 + typedef typename regex_iterator_type::difference_type rit_difference_type;
1.488 + typedef typename regex_iterator_type::pointer rit_pointer;
1.489 + typedef typename regex_iterator_type::reference rit_reference;
1.490 + typedef typename regex_iterator_type::iterator_category rit_iterator_category;
1.491 + BOOST_STATIC_ASSERT((::boost::is_same<rit_regex_type, Regex>::value));
1.492 + BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_type>::value));
1.493 + BOOST_STATIC_ASSERT((::boost::is_same<rit_difference_type, std::ptrdiff_t>::value));
1.494 + BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_type*>::value));
1.495 + BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_type&>::value));
1.496 + BOOST_STATIC_ASSERT((::boost::is_convertible<rit_iterator_category*, std::forward_iterator_tag*>::value));
1.497 + // this takes care of most of the checks needed:
1.498 + function_requires<ForwardIteratorConcept<regex_iterator_type> >();
1.499 + regex_iterator_type iter1(m_in, m_in, e);
1.500 + ignore_unused_variable_warning(iter1);
1.501 + regex_iterator_type iter2(m_in, m_in, e, m_mft);
1.502 + ignore_unused_variable_warning(iter2);
1.503 +
1.504 + // regex_token_iterator:
1.505 + typedef typename regex_token_iterator_type::regex_type rtit_regex_type;
1.506 + typedef typename regex_token_iterator_type::value_type rtit_value_type;
1.507 + typedef typename regex_token_iterator_type::difference_type rtit_difference_type;
1.508 + typedef typename regex_token_iterator_type::pointer rtit_pointer;
1.509 + typedef typename regex_token_iterator_type::reference rtit_reference;
1.510 + typedef typename regex_token_iterator_type::iterator_category rtit_iterator_category;
1.511 + BOOST_STATIC_ASSERT((::boost::is_same<rtit_regex_type, Regex>::value));
1.512 + BOOST_STATIC_ASSERT((::boost::is_same<rtit_value_type, sub_match_type>::value));
1.513 + BOOST_STATIC_ASSERT((::boost::is_same<rtit_difference_type, std::ptrdiff_t>::value));
1.514 + BOOST_STATIC_ASSERT((::boost::is_same<rtit_pointer, const sub_match_type*>::value));
1.515 + BOOST_STATIC_ASSERT((::boost::is_same<rtit_reference, const sub_match_type&>::value));
1.516 + BOOST_STATIC_ASSERT((::boost::is_convertible<rtit_iterator_category*, std::forward_iterator_tag*>::value));
1.517 + // this takes care of most of the checks needed:
1.518 + function_requires<ForwardIteratorConcept<regex_token_iterator_type> >();
1.519 + regex_token_iterator_type ti1(m_in, m_in, e);
1.520 + ignore_unused_variable_warning(ti1);
1.521 + regex_token_iterator_type ti2(m_in, m_in, e, 0);
1.522 + ignore_unused_variable_warning(ti2);
1.523 + regex_token_iterator_type ti3(m_in, m_in, e, 0, m_mft);
1.524 + ignore_unused_variable_warning(ti3);
1.525 + std::vector<int> subs;
1.526 + regex_token_iterator_type ti4(m_in, m_in, e, subs);
1.527 + ignore_unused_variable_warning(ti4);
1.528 + regex_token_iterator_type ti5(m_in, m_in, e, subs, m_mft);
1.529 + ignore_unused_variable_warning(ti5);
1.530 + static const int i_array[3] = { 1, 2, 3, };
1.531 + regex_token_iterator_type ti6(m_in, m_in, e, i_array);
1.532 + ignore_unused_variable_warning(ti6);
1.533 + regex_token_iterator_type ti7(m_in, m_in, e, i_array, m_mft);
1.534 + ignore_unused_variable_warning(ti7);
1.535 + }
1.536 +
1.537 + pointer_type m_pointer;
1.538 + flag_type m_flags;
1.539 + size_type m_size;
1.540 + input_iterator_type in1, in2;
1.541 + const sub_match_type m_sub;
1.542 + const value_type m_char;
1.543 + match_results_type m_results;
1.544 + const match_results_type m_cresults;
1.545 + OutIterator m_out;
1.546 + BidiIterator m_in;
1.547 + global_regex_namespace::regex_constants::match_flag_type m_mft;
1.548 + global_regex_namespace::match_results<pointer_type> m_pmatch;
1.549 +
1.550 + BaseRegexConcept();
1.551 + BaseRegexConcept(const BaseRegexConcept&);
1.552 + BaseRegexConcept& operator=(const BaseRegexConcept&);
1.553 +};
1.554 +
1.555 +//
1.556 +// RegexConcept:
1.557 +// Test every interface in the std:
1.558 +//
1.559 +template <class Regex>
1.560 +struct RegexConcept
1.561 +{
1.562 + typedef typename Regex::value_type value_type;
1.563 + typedef typename Regex::size_type size_type;
1.564 + typedef typename Regex::flag_type flag_type;
1.565 + typedef typename Regex::locale_type locale_type;
1.566 +
1.567 + // derived test types:
1.568 + typedef const value_type* pointer_type;
1.569 + typedef std::basic_string<value_type> string_type;
1.570 + typedef boost::bidirectional_iterator_archetype<value_type> BidiIterator;
1.571 + typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
1.572 + typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
1.573 + typedef output_iterator_archetype<value_type> OutIterator;
1.574 +
1.575 +
1.576 + void constraints()
1.577 + {
1.578 + function_requires<BaseRegexConcept<Regex> >();
1.579 + // string based construct:
1.580 + Regex e1(m_string);
1.581 + ignore_unused_variable_warning(e1);
1.582 + Regex e2(m_string, m_flags);
1.583 + ignore_unused_variable_warning(e2);
1.584 +
1.585 + // assign etc:
1.586 + Regex e;
1.587 + e = m_string;
1.588 + e.assign(m_string);
1.589 + e.assign(m_string, m_flags);
1.590 +
1.591 + // sub_match:
1.592 + string_type s(m_sub);
1.593 + ignore_unused_variable_warning(s);
1.594 + s = m_sub.str();
1.595 + ignore_unused_variable_warning(s);
1.596 + int i = m_sub.compare(m_string);
1.597 + ignore_unused_variable_warning(i);
1.598 +
1.599 + int i2 = m_sub.compare(m_sub);
1.600 + ignore_unused_variable_warning(i2);
1.601 + i2 = m_sub.compare(m_pointer);
1.602 + ignore_unused_variable_warning(i2);
1.603 +
1.604 + bool b = m_sub == m_sub;
1.605 + ignore_unused_variable_warning(b);
1.606 + b = m_sub != m_sub;
1.607 + ignore_unused_variable_warning(b);
1.608 + b = m_sub <= m_sub;
1.609 + ignore_unused_variable_warning(b);
1.610 + b = m_sub <= m_sub;
1.611 + ignore_unused_variable_warning(b);
1.612 + b = m_sub > m_sub;
1.613 + ignore_unused_variable_warning(b);
1.614 + b = m_sub >= m_sub;
1.615 + ignore_unused_variable_warning(b);
1.616 +
1.617 + b = m_sub == m_pointer;
1.618 + ignore_unused_variable_warning(b);
1.619 + b = m_sub != m_pointer;
1.620 + ignore_unused_variable_warning(b);
1.621 + b = m_sub <= m_pointer;
1.622 + ignore_unused_variable_warning(b);
1.623 + b = m_sub <= m_pointer;
1.624 + ignore_unused_variable_warning(b);
1.625 + b = m_sub > m_pointer;
1.626 + ignore_unused_variable_warning(b);
1.627 + b = m_sub >= m_pointer;
1.628 + ignore_unused_variable_warning(b);
1.629 +
1.630 + b = m_pointer == m_sub;
1.631 + ignore_unused_variable_warning(b);
1.632 + b = m_pointer != m_sub;
1.633 + ignore_unused_variable_warning(b);
1.634 + b = m_pointer <= m_sub;
1.635 + ignore_unused_variable_warning(b);
1.636 + b = m_pointer <= m_sub;
1.637 + ignore_unused_variable_warning(b);
1.638 + b = m_pointer > m_sub;
1.639 + ignore_unused_variable_warning(b);
1.640 + b = m_pointer >= m_sub;
1.641 + ignore_unused_variable_warning(b);
1.642 +
1.643 + b = m_sub == m_char;
1.644 + ignore_unused_variable_warning(b);
1.645 + b = m_sub != m_char;
1.646 + ignore_unused_variable_warning(b);
1.647 + b = m_sub <= m_char;
1.648 + ignore_unused_variable_warning(b);
1.649 + b = m_sub <= m_char;
1.650 + ignore_unused_variable_warning(b);
1.651 + b = m_sub > m_char;
1.652 + ignore_unused_variable_warning(b);
1.653 + b = m_sub >= m_char;
1.654 + ignore_unused_variable_warning(b);
1.655 +
1.656 + b = m_char == m_sub;
1.657 + ignore_unused_variable_warning(b);
1.658 + b = m_char != m_sub;
1.659 + ignore_unused_variable_warning(b);
1.660 + b = m_char <= m_sub;
1.661 + ignore_unused_variable_warning(b);
1.662 + b = m_char <= m_sub;
1.663 + ignore_unused_variable_warning(b);
1.664 + b = m_char > m_sub;
1.665 + ignore_unused_variable_warning(b);
1.666 + b = m_char >= m_sub;
1.667 + ignore_unused_variable_warning(b);
1.668 +
1.669 + b = m_sub == m_string;
1.670 + ignore_unused_variable_warning(b);
1.671 + b = m_sub != m_string;
1.672 + ignore_unused_variable_warning(b);
1.673 + b = m_sub <= m_string;
1.674 + ignore_unused_variable_warning(b);
1.675 + b = m_sub <= m_string;
1.676 + ignore_unused_variable_warning(b);
1.677 + b = m_sub > m_string;
1.678 + ignore_unused_variable_warning(b);
1.679 + b = m_sub >= m_string;
1.680 + ignore_unused_variable_warning(b);
1.681 +
1.682 + b = m_string == m_sub;
1.683 + ignore_unused_variable_warning(b);
1.684 + b = m_string != m_sub;
1.685 + ignore_unused_variable_warning(b);
1.686 + b = m_string <= m_sub;
1.687 + ignore_unused_variable_warning(b);
1.688 + b = m_string <= m_sub;
1.689 + ignore_unused_variable_warning(b);
1.690 + b = m_string > m_sub;
1.691 + ignore_unused_variable_warning(b);
1.692 + b = m_string >= m_sub;
1.693 + ignore_unused_variable_warning(b);
1.694 +
1.695 + // match results:
1.696 + m_string = m_results.str();
1.697 + ignore_unused_variable_warning(m_string);
1.698 + m_string = m_results.str(0);
1.699 + ignore_unused_variable_warning(m_string);
1.700 + m_out = m_cresults.format(m_out, m_string);
1.701 + m_out = m_cresults.format(m_out, m_string, m_mft);
1.702 + m_string = m_cresults.format(m_string);
1.703 + ignore_unused_variable_warning(m_string);
1.704 + m_string = m_cresults.format(m_string, m_mft);
1.705 + ignore_unused_variable_warning(m_string);
1.706 +
1.707 + // regex_match:
1.708 + b = global_regex_namespace::regex_match(m_string, m_smatch, e);
1.709 + ignore_unused_variable_warning(b);
1.710 + b = global_regex_namespace::regex_match(m_string, m_smatch, e, m_mft);
1.711 + ignore_unused_variable_warning(b);
1.712 + b = global_regex_namespace::regex_match(m_string, e);
1.713 + ignore_unused_variable_warning(b);
1.714 + b = global_regex_namespace::regex_match(m_string, e, m_mft);
1.715 + ignore_unused_variable_warning(b);
1.716 +
1.717 + // regex_search:
1.718 + b = global_regex_namespace::regex_search(m_string, m_smatch, e);
1.719 + ignore_unused_variable_warning(b);
1.720 + b = global_regex_namespace::regex_search(m_string, m_smatch, e, m_mft);
1.721 + ignore_unused_variable_warning(b);
1.722 + b = global_regex_namespace::regex_search(m_string, e);
1.723 + ignore_unused_variable_warning(b);
1.724 + b = global_regex_namespace::regex_search(m_string, e, m_mft);
1.725 + ignore_unused_variable_warning(b);
1.726 +
1.727 + // regex_replace:
1.728 + m_out = global_regex_namespace::regex_replace(m_out, m_in, m_in, e, m_string, m_mft);
1.729 + m_out = global_regex_namespace::regex_replace(m_out, m_in, m_in, e, m_string);
1.730 + m_string = global_regex_namespace::regex_replace(m_string, e, m_string, m_mft);
1.731 + ignore_unused_variable_warning(m_string);
1.732 + m_string = global_regex_namespace::regex_replace(m_string, e, m_string);
1.733 + ignore_unused_variable_warning(m_string);
1.734 +
1.735 + }
1.736 +
1.737 + flag_type m_flags;
1.738 + string_type m_string;
1.739 + const sub_match_type m_sub;
1.740 + match_results_type m_results;
1.741 + pointer_type m_pointer;
1.742 + value_type m_char;
1.743 + const match_results_type m_cresults;
1.744 + OutIterator m_out;
1.745 + BidiIterator m_in;
1.746 + global_regex_namespace::regex_constants::match_flag_type m_mft;
1.747 + global_regex_namespace::match_results<typename string_type::const_iterator> m_smatch;
1.748 +
1.749 + RegexConcept();
1.750 + RegexConcept(const RegexConcept&);
1.751 + RegexConcept& operator=(const RegexConcept&);
1.752 +};
1.753 +
1.754 +#ifndef BOOST_REGEX_TEST_STD
1.755 +//
1.756 +// BoostRegexConcept:
1.757 +// Test every interface in the Boost implementation:
1.758 +//
1.759 +template <class Regex>
1.760 +struct BoostRegexConcept
1.761 +{
1.762 + typedef typename Regex::value_type value_type;
1.763 + typedef typename Regex::size_type size_type;
1.764 + typedef typename Regex::flag_type flag_type;
1.765 + typedef typename Regex::locale_type locale_type;
1.766 +
1.767 + // derived test types:
1.768 + typedef const value_type* pointer_type;
1.769 + typedef std::basic_string<value_type> string_type;
1.770 + typedef typename Regex::const_iterator const_iterator;
1.771 + typedef bidirectional_iterator_archetype<value_type> BidiIterator;
1.772 + typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
1.773 + typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
1.774 +
1.775 + void constraints()
1.776 + {
1.777 + global_regex_namespace::regex_constants::match_flag_type mopts
1.778 + = global_regex_namespace::regex_constants::match_default
1.779 + | global_regex_namespace::regex_constants::match_not_bol
1.780 + | global_regex_namespace::regex_constants::match_not_eol
1.781 + | global_regex_namespace::regex_constants::match_not_bow
1.782 + | global_regex_namespace::regex_constants::match_not_eow
1.783 + | global_regex_namespace::regex_constants::match_any
1.784 + | global_regex_namespace::regex_constants::match_not_null
1.785 + | global_regex_namespace::regex_constants::match_continuous
1.786 + | global_regex_namespace::regex_constants::match_partial
1.787 + | global_regex_namespace::regex_constants::match_prev_avail
1.788 + | global_regex_namespace::regex_constants::format_default
1.789 + | global_regex_namespace::regex_constants::format_sed
1.790 + | global_regex_namespace::regex_constants::format_perl
1.791 + | global_regex_namespace::regex_constants::format_no_copy
1.792 + | global_regex_namespace::regex_constants::format_first_only;
1.793 +
1.794 + (void)mopts;
1.795 +
1.796 + function_requires<RegexConcept<Regex> >();
1.797 + const global_regex_namespace::regex_error except(global_regex_namespace::regex_constants::error_collate);
1.798 + std::ptrdiff_t pt = except.position();
1.799 + ignore_unused_variable_warning(pt);
1.800 + const Regex ce, ce2;
1.801 +#ifndef BOOST_NO_STD_LOCALE
1.802 + m_stream << ce;
1.803 +#endif
1.804 + unsigned i = ce.error_code();
1.805 + ignore_unused_variable_warning(i);
1.806 + pointer_type p = ce.expression();
1.807 + ignore_unused_variable_warning(p);
1.808 + int i2 = ce.compare(ce2);
1.809 + ignore_unused_variable_warning(i2);
1.810 + bool b = ce == ce2;
1.811 + ignore_unused_variable_warning(b);
1.812 + b = ce != ce2;
1.813 + ignore_unused_variable_warning(b);
1.814 + b = ce < ce2;
1.815 + ignore_unused_variable_warning(b);
1.816 + b = ce > ce2;
1.817 + ignore_unused_variable_warning(b);
1.818 + b = ce <= ce2;
1.819 + ignore_unused_variable_warning(b);
1.820 + b = ce >= ce2;
1.821 + ignore_unused_variable_warning(b);
1.822 + i = ce.status();
1.823 + ignore_unused_variable_warning(i);
1.824 + size_type s = ce.max_size();
1.825 + ignore_unused_variable_warning(s);
1.826 + s = ce.size();
1.827 + ignore_unused_variable_warning(s);
1.828 + const_iterator pi = ce.begin();
1.829 + ignore_unused_variable_warning(pi);
1.830 + pi = ce.end();
1.831 + ignore_unused_variable_warning(pi);
1.832 + string_type s2 = ce.str();
1.833 + ignore_unused_variable_warning(s2);
1.834 +
1.835 + m_string = m_sub + m_sub;
1.836 + ignore_unused_variable_warning(m_string);
1.837 + m_string = m_sub + m_pointer;
1.838 + ignore_unused_variable_warning(m_string);
1.839 + m_string = m_pointer + m_sub;
1.840 + ignore_unused_variable_warning(m_string);
1.841 + m_string = m_sub + m_string;
1.842 + ignore_unused_variable_warning(m_string);
1.843 + m_string = m_string + m_sub;
1.844 + ignore_unused_variable_warning(m_string);
1.845 + m_string = m_sub + m_char;
1.846 + ignore_unused_variable_warning(m_string);
1.847 + m_string = m_char + m_sub;
1.848 + ignore_unused_variable_warning(m_string);
1.849 +
1.850 +#ifndef BOOST_NO_STD_LOCALE
1.851 + m_stream << m_sub;
1.852 + m_stream << m_cresults;
1.853 +#endif
1.854 + }
1.855 +
1.856 + std::basic_ostream<value_type> m_stream;
1.857 + sub_match_type m_sub;
1.858 + pointer_type m_pointer;
1.859 + string_type m_string;
1.860 + const value_type m_char;
1.861 + match_results_type m_results;
1.862 + const match_results_type m_cresults;
1.863 +
1.864 + BoostRegexConcept();
1.865 + BoostRegexConcept(const BoostRegexConcept&);
1.866 + BoostRegexConcept& operator=(const BoostRegexConcept&);
1.867 +};
1.868 +
1.869 +#endif // BOOST_REGEX_TEST_STD
1.870 +
1.871 +}
1.872 +
1.873 +#endif