annotate DEPENDENCIES/generic/include/boost/regex/concepts.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 *
Chris@16 3 * Copyright (c) 2004
Chris@16 4 * John Maddock
Chris@16 5 *
Chris@16 6 * Use, modification and distribution are subject to the
Chris@16 7 * Boost Software License, Version 1.0. (See accompanying file
Chris@16 8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 *
Chris@16 10 */
Chris@16 11
Chris@16 12 /*
Chris@16 13 * LOCATION: see http://www.boost.org for most recent version.
Chris@16 14 * FILE concepts.hpp
Chris@16 15 * VERSION see <boost/version.hpp>
Chris@16 16 * DESCRIPTION: Declares regular expression concepts.
Chris@16 17 */
Chris@16 18
Chris@16 19 #ifndef BOOST_REGEX_CONCEPTS_HPP_INCLUDED
Chris@16 20 #define BOOST_REGEX_CONCEPTS_HPP_INCLUDED
Chris@16 21
Chris@16 22 #include <boost/concept_archetype.hpp>
Chris@16 23 #include <boost/concept_check.hpp>
Chris@16 24 #include <boost/type_traits/is_enum.hpp>
Chris@16 25 #include <boost/type_traits/is_base_and_derived.hpp>
Chris@16 26 #include <boost/static_assert.hpp>
Chris@16 27 #ifndef BOOST_TEST_TR1_REGEX
Chris@16 28 #include <boost/regex.hpp>
Chris@16 29 #endif
Chris@16 30 #include <bitset>
Chris@16 31 #include <vector>
Chris@16 32 #include <iostream>
Chris@16 33
Chris@16 34 namespace boost{
Chris@16 35
Chris@16 36 //
Chris@16 37 // bitmask_archetype:
Chris@16 38 // this can be either an integer type, an enum, or a std::bitset,
Chris@16 39 // we use the latter as the architype as it offers the "strictest"
Chris@16 40 // of the possible interfaces:
Chris@16 41 //
Chris@16 42 typedef std::bitset<512> bitmask_archetype;
Chris@16 43 //
Chris@16 44 // char_architype:
Chris@16 45 // A strict model for the character type interface.
Chris@16 46 //
Chris@16 47 struct char_architype
Chris@16 48 {
Chris@16 49 // default constructable:
Chris@16 50 char_architype();
Chris@16 51 // copy constructable / assignable:
Chris@16 52 char_architype(const char_architype&);
Chris@16 53 char_architype& operator=(const char_architype&);
Chris@16 54 // constructable from an integral value:
Chris@16 55 char_architype(unsigned long val);
Chris@16 56 // comparable:
Chris@16 57 bool operator==(const char_architype&)const;
Chris@16 58 bool operator!=(const char_architype&)const;
Chris@16 59 bool operator<(const char_architype&)const;
Chris@16 60 bool operator<=(const char_architype&)const;
Chris@16 61 bool operator>=(const char_architype&)const;
Chris@16 62 bool operator>(const char_architype&)const;
Chris@16 63 // conversion to integral type:
Chris@16 64 operator long()const;
Chris@16 65 };
Chris@16 66 inline long hash_value(char_architype val)
Chris@16 67 { return val; }
Chris@16 68 //
Chris@16 69 // char_architype can not be used with basic_string:
Chris@16 70 //
Chris@16 71 } // namespace boost
Chris@16 72 namespace std{
Chris@16 73 template<> struct char_traits<boost::char_architype>
Chris@16 74 {
Chris@16 75 // The intent is that this template is not instantiated,
Chris@16 76 // but this typedef gives us a chance of compilation in
Chris@16 77 // case it is:
Chris@16 78 typedef boost::char_architype char_type;
Chris@16 79 };
Chris@16 80 }
Chris@16 81 //
Chris@16 82 // Allocator architype:
Chris@16 83 //
Chris@16 84 template <class T>
Chris@16 85 class allocator_architype
Chris@16 86 {
Chris@16 87 public:
Chris@16 88 typedef T* pointer;
Chris@16 89 typedef const T* const_pointer;
Chris@16 90 typedef T& reference;
Chris@16 91 typedef const T& const_reference;
Chris@16 92 typedef T value_type;
Chris@16 93 typedef unsigned size_type;
Chris@16 94 typedef int difference_type;
Chris@16 95
Chris@16 96 template <class U>
Chris@16 97 struct rebind
Chris@16 98 {
Chris@16 99 typedef allocator_architype<U> other;
Chris@16 100 };
Chris@16 101
Chris@16 102 pointer address(reference r);
Chris@16 103 const_pointer address(const_reference r);
Chris@16 104 pointer allocate(size_type);
Chris@16 105 pointer allocate(size_type, pointer);
Chris@16 106 void deallocate(pointer, size_type);
Chris@16 107 size_type max_size()const;
Chris@16 108
Chris@16 109 allocator_architype();
Chris@16 110 allocator_architype(const allocator_architype&);
Chris@16 111
Chris@16 112 template <class Other>
Chris@16 113 allocator_architype(const allocator_architype<Other>&);
Chris@16 114
Chris@16 115 void construct(pointer, const_reference);
Chris@16 116 void destroy(pointer);
Chris@16 117 };
Chris@16 118
Chris@16 119 template <class T>
Chris@16 120 bool operator == (const allocator_architype<T>&, const allocator_architype<T>&);
Chris@16 121 template <class T>
Chris@16 122 bool operator != (const allocator_architype<T>&, const allocator_architype<T>&);
Chris@16 123
Chris@16 124 namespace boost{
Chris@16 125 //
Chris@16 126 // regex_traits_architype:
Chris@16 127 // A strict interpretation of the regular expression traits class requirements.
Chris@16 128 //
Chris@16 129 template <class charT>
Chris@16 130 struct regex_traits_architype
Chris@16 131 {
Chris@16 132 public:
Chris@16 133 regex_traits_architype();
Chris@16 134 typedef charT char_type;
Chris@16 135 // typedef std::size_t size_type;
Chris@16 136 typedef std::vector<char_type> string_type;
Chris@16 137 typedef copy_constructible_archetype<assignable_archetype<> > locale_type;
Chris@16 138 typedef bitmask_archetype char_class_type;
Chris@16 139
Chris@16 140 static std::size_t length(const char_type* ) { return 0; }
Chris@16 141
Chris@16 142 charT translate(charT ) const { return charT(); }
Chris@16 143 charT translate_nocase(charT ) const { return static_object<charT>::get(); }
Chris@16 144
Chris@16 145 template <class ForwardIterator>
Chris@16 146 string_type transform(ForwardIterator , ForwardIterator ) const
Chris@16 147 { return static_object<string_type>::get(); }
Chris@16 148 template <class ForwardIterator>
Chris@16 149 string_type transform_primary(ForwardIterator , ForwardIterator ) const
Chris@16 150 { return static_object<string_type>::get(); }
Chris@16 151
Chris@16 152 template <class ForwardIterator>
Chris@16 153 char_class_type lookup_classname(ForwardIterator , ForwardIterator ) const
Chris@16 154 { return static_object<char_class_type>::get(); }
Chris@16 155 template <class ForwardIterator>
Chris@16 156 string_type lookup_collatename(ForwardIterator , ForwardIterator ) const
Chris@16 157 { return static_object<string_type>::get(); }
Chris@16 158
Chris@16 159 bool isctype(charT, char_class_type) const
Chris@16 160 { return false; }
Chris@16 161 int value(charT, int) const
Chris@16 162 { return 0; }
Chris@16 163
Chris@16 164 locale_type imbue(locale_type l)
Chris@16 165 { return l; }
Chris@16 166 locale_type getloc()const
Chris@16 167 { return static_object<locale_type>::get(); }
Chris@16 168
Chris@16 169 private:
Chris@16 170 // this type is not copyable:
Chris@16 171 regex_traits_architype(const regex_traits_architype&);
Chris@16 172 regex_traits_architype& operator=(const regex_traits_architype&);
Chris@16 173 };
Chris@16 174
Chris@16 175 //
Chris@16 176 // alter this to std::tr1, to test a std implementation:
Chris@16 177 //
Chris@16 178 #ifndef BOOST_TEST_TR1_REGEX
Chris@16 179 namespace global_regex_namespace = ::boost;
Chris@16 180 #else
Chris@16 181 namespace global_regex_namespace = ::std::tr1;
Chris@16 182 #endif
Chris@16 183
Chris@16 184 template <class Bitmask>
Chris@16 185 struct BitmaskConcept
Chris@16 186 {
Chris@16 187 void constraints()
Chris@16 188 {
Chris@16 189 function_requires<CopyConstructibleConcept<Bitmask> >();
Chris@16 190 function_requires<AssignableConcept<Bitmask> >();
Chris@16 191
Chris@16 192 m_mask1 = m_mask2 | m_mask3;
Chris@16 193 m_mask1 = m_mask2 & m_mask3;
Chris@16 194 m_mask1 = m_mask2 ^ m_mask3;
Chris@16 195
Chris@16 196 m_mask1 = ~m_mask2;
Chris@16 197
Chris@16 198 m_mask1 |= m_mask2;
Chris@16 199 m_mask1 &= m_mask2;
Chris@16 200 m_mask1 ^= m_mask2;
Chris@16 201 }
Chris@16 202 Bitmask m_mask1, m_mask2, m_mask3;
Chris@16 203 };
Chris@16 204
Chris@16 205 template <class traits>
Chris@16 206 struct RegexTraitsConcept
Chris@16 207 {
Chris@16 208 RegexTraitsConcept();
Chris@16 209 // required typedefs:
Chris@16 210 typedef typename traits::char_type char_type;
Chris@16 211 // typedef typename traits::size_type size_type;
Chris@16 212 typedef typename traits::string_type string_type;
Chris@16 213 typedef typename traits::locale_type locale_type;
Chris@16 214 typedef typename traits::char_class_type char_class_type;
Chris@16 215
Chris@16 216 void constraints()
Chris@16 217 {
Chris@16 218 //function_requires<UnsignedIntegerConcept<size_type> >();
Chris@16 219 function_requires<RandomAccessContainerConcept<string_type> >();
Chris@16 220 function_requires<DefaultConstructibleConcept<locale_type> >();
Chris@16 221 function_requires<CopyConstructibleConcept<locale_type> >();
Chris@16 222 function_requires<AssignableConcept<locale_type> >();
Chris@16 223 function_requires<BitmaskConcept<char_class_type> >();
Chris@16 224
Chris@16 225 std::size_t n = traits::length(m_pointer);
Chris@16 226 ignore_unused_variable_warning(n);
Chris@16 227
Chris@16 228 char_type c = m_ctraits.translate(m_char);
Chris@16 229 ignore_unused_variable_warning(c);
Chris@16 230 c = m_ctraits.translate_nocase(m_char);
Chris@16 231
Chris@16 232 //string_type::foobar bar;
Chris@16 233 string_type s1 = m_ctraits.transform(m_pointer, m_pointer);
Chris@16 234 ignore_unused_variable_warning(s1);
Chris@16 235
Chris@16 236 string_type s2 = m_ctraits.transform_primary(m_pointer, m_pointer);
Chris@16 237 ignore_unused_variable_warning(s2);
Chris@16 238
Chris@16 239 char_class_type cc = m_ctraits.lookup_classname(m_pointer, m_pointer);
Chris@16 240 ignore_unused_variable_warning(cc);
Chris@16 241
Chris@16 242 string_type s3 = m_ctraits.lookup_collatename(m_pointer, m_pointer);
Chris@16 243 ignore_unused_variable_warning(s3);
Chris@16 244
Chris@16 245 bool b = m_ctraits.isctype(m_char, cc);
Chris@16 246 ignore_unused_variable_warning(b);
Chris@16 247
Chris@16 248 int v = m_ctraits.value(m_char, 16);
Chris@16 249 ignore_unused_variable_warning(v);
Chris@16 250
Chris@16 251 locale_type l(m_ctraits.getloc());
Chris@16 252 m_traits.imbue(l);
Chris@16 253 ignore_unused_variable_warning(l);
Chris@16 254 }
Chris@16 255 traits m_traits;
Chris@16 256 const traits m_ctraits;
Chris@16 257 const char_type* m_pointer;
Chris@16 258 char_type m_char;
Chris@16 259 private:
Chris@16 260 RegexTraitsConcept& operator=(RegexTraitsConcept&);
Chris@16 261 };
Chris@16 262
Chris@16 263 //
Chris@16 264 // helper class to compute what traits class a regular expression type is using:
Chris@16 265 //
Chris@16 266 template <class Regex>
Chris@16 267 struct regex_traits_computer;
Chris@16 268
Chris@16 269 template <class charT, class traits>
Chris@16 270 struct regex_traits_computer< global_regex_namespace::basic_regex<charT, traits> >
Chris@16 271 {
Chris@16 272 typedef traits type;
Chris@16 273 };
Chris@16 274
Chris@16 275 //
Chris@16 276 // BaseRegexConcept does not test anything dependent on basic_string,
Chris@16 277 // in case our charT does not have an associated char_traits:
Chris@16 278 //
Chris@16 279 template <class Regex>
Chris@16 280 struct BaseRegexConcept
Chris@16 281 {
Chris@16 282 typedef typename Regex::value_type value_type;
Chris@16 283 //typedef typename Regex::size_type size_type;
Chris@16 284 typedef typename Regex::flag_type flag_type;
Chris@16 285 typedef typename Regex::locale_type locale_type;
Chris@16 286 typedef input_iterator_archetype<value_type> input_iterator_type;
Chris@16 287
Chris@16 288 // derived test types:
Chris@16 289 typedef const value_type* pointer_type;
Chris@16 290 typedef bidirectional_iterator_archetype<value_type> BidiIterator;
Chris@16 291 typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
Chris@16 292 typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
Chris@16 293 typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
Chris@16 294 typedef output_iterator_archetype<value_type> OutIterator;
Chris@16 295 typedef typename regex_traits_computer<Regex>::type traits_type;
Chris@16 296 typedef global_regex_namespace::regex_iterator<BidiIterator, value_type, traits_type> regex_iterator_type;
Chris@16 297 typedef global_regex_namespace::regex_token_iterator<BidiIterator, value_type, traits_type> regex_token_iterator_type;
Chris@16 298
Chris@16 299 void global_constraints()
Chris@16 300 {
Chris@16 301 //
Chris@16 302 // test non-template components:
Chris@16 303 //
Chris@16 304 function_requires<BitmaskConcept<global_regex_namespace::regex_constants::syntax_option_type> >();
Chris@16 305 global_regex_namespace::regex_constants::syntax_option_type opts
Chris@16 306 = global_regex_namespace::regex_constants::icase
Chris@16 307 | global_regex_namespace::regex_constants::nosubs
Chris@16 308 | global_regex_namespace::regex_constants::optimize
Chris@16 309 | global_regex_namespace::regex_constants::collate
Chris@16 310 | global_regex_namespace::regex_constants::ECMAScript
Chris@16 311 | global_regex_namespace::regex_constants::basic
Chris@16 312 | global_regex_namespace::regex_constants::extended
Chris@16 313 | global_regex_namespace::regex_constants::awk
Chris@16 314 | global_regex_namespace::regex_constants::grep
Chris@16 315 | global_regex_namespace::regex_constants::egrep;
Chris@16 316 ignore_unused_variable_warning(opts);
Chris@16 317
Chris@16 318 function_requires<BitmaskConcept<global_regex_namespace::regex_constants::match_flag_type> >();
Chris@16 319 global_regex_namespace::regex_constants::match_flag_type mopts
Chris@16 320 = global_regex_namespace::regex_constants::match_default
Chris@16 321 | global_regex_namespace::regex_constants::match_not_bol
Chris@16 322 | global_regex_namespace::regex_constants::match_not_eol
Chris@16 323 | global_regex_namespace::regex_constants::match_not_bow
Chris@16 324 | global_regex_namespace::regex_constants::match_not_eow
Chris@16 325 | global_regex_namespace::regex_constants::match_any
Chris@16 326 | global_regex_namespace::regex_constants::match_not_null
Chris@16 327 | global_regex_namespace::regex_constants::match_continuous
Chris@16 328 | global_regex_namespace::regex_constants::match_prev_avail
Chris@16 329 | global_regex_namespace::regex_constants::format_default
Chris@16 330 | global_regex_namespace::regex_constants::format_sed
Chris@16 331 | global_regex_namespace::regex_constants::format_no_copy
Chris@16 332 | global_regex_namespace::regex_constants::format_first_only;
Chris@16 333 ignore_unused_variable_warning(mopts);
Chris@16 334
Chris@16 335 BOOST_STATIC_ASSERT((::boost::is_enum<global_regex_namespace::regex_constants::error_type>::value));
Chris@16 336 global_regex_namespace::regex_constants::error_type e1 = global_regex_namespace::regex_constants::error_collate;
Chris@16 337 ignore_unused_variable_warning(e1);
Chris@16 338 e1 = global_regex_namespace::regex_constants::error_ctype;
Chris@16 339 ignore_unused_variable_warning(e1);
Chris@16 340 e1 = global_regex_namespace::regex_constants::error_escape;
Chris@16 341 ignore_unused_variable_warning(e1);
Chris@16 342 e1 = global_regex_namespace::regex_constants::error_backref;
Chris@16 343 ignore_unused_variable_warning(e1);
Chris@16 344 e1 = global_regex_namespace::regex_constants::error_brack;
Chris@16 345 ignore_unused_variable_warning(e1);
Chris@16 346 e1 = global_regex_namespace::regex_constants::error_paren;
Chris@16 347 ignore_unused_variable_warning(e1);
Chris@16 348 e1 = global_regex_namespace::regex_constants::error_brace;
Chris@16 349 ignore_unused_variable_warning(e1);
Chris@16 350 e1 = global_regex_namespace::regex_constants::error_badbrace;
Chris@16 351 ignore_unused_variable_warning(e1);
Chris@16 352 e1 = global_regex_namespace::regex_constants::error_range;
Chris@16 353 ignore_unused_variable_warning(e1);
Chris@16 354 e1 = global_regex_namespace::regex_constants::error_space;
Chris@16 355 ignore_unused_variable_warning(e1);
Chris@16 356 e1 = global_regex_namespace::regex_constants::error_badrepeat;
Chris@16 357 ignore_unused_variable_warning(e1);
Chris@16 358 e1 = global_regex_namespace::regex_constants::error_complexity;
Chris@16 359 ignore_unused_variable_warning(e1);
Chris@16 360 e1 = global_regex_namespace::regex_constants::error_stack;
Chris@16 361 ignore_unused_variable_warning(e1);
Chris@16 362
Chris@16 363 BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::runtime_error, global_regex_namespace::regex_error>::value ));
Chris@16 364 const global_regex_namespace::regex_error except(e1);
Chris@16 365 e1 = except.code();
Chris@16 366
Chris@16 367 typedef typename Regex::value_type regex_value_type;
Chris@16 368 function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
Chris@16 369 function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
Chris@16 370 }
Chris@16 371 void constraints()
Chris@16 372 {
Chris@16 373 global_constraints();
Chris@16 374
Chris@16 375 BOOST_STATIC_ASSERT((::boost::is_same< flag_type, global_regex_namespace::regex_constants::syntax_option_type>::value));
Chris@16 376 flag_type opts
Chris@16 377 = Regex::icase
Chris@16 378 | Regex::nosubs
Chris@16 379 | Regex::optimize
Chris@16 380 | Regex::collate
Chris@16 381 | Regex::ECMAScript
Chris@16 382 | Regex::basic
Chris@16 383 | Regex::extended
Chris@16 384 | Regex::awk
Chris@16 385 | Regex::grep
Chris@16 386 | Regex::egrep;
Chris@16 387 ignore_unused_variable_warning(opts);
Chris@16 388
Chris@16 389 function_requires<DefaultConstructibleConcept<Regex> >();
Chris@16 390 function_requires<CopyConstructibleConcept<Regex> >();
Chris@16 391
Chris@16 392 // Regex constructors:
Chris@16 393 Regex e1(m_pointer);
Chris@16 394 ignore_unused_variable_warning(e1);
Chris@16 395 Regex e2(m_pointer, m_flags);
Chris@16 396 ignore_unused_variable_warning(e2);
Chris@16 397 Regex e3(m_pointer, m_size, m_flags);
Chris@16 398 ignore_unused_variable_warning(e3);
Chris@16 399 Regex e4(in1, in2);
Chris@16 400 ignore_unused_variable_warning(e4);
Chris@16 401 Regex e5(in1, in2, m_flags);
Chris@16 402 ignore_unused_variable_warning(e5);
Chris@16 403
Chris@16 404 // assign etc:
Chris@16 405 Regex e;
Chris@16 406 e = m_pointer;
Chris@16 407 e = e1;
Chris@16 408 e.assign(e1);
Chris@16 409 e.assign(m_pointer);
Chris@16 410 e.assign(m_pointer, m_flags);
Chris@16 411 e.assign(m_pointer, m_size, m_flags);
Chris@16 412 e.assign(in1, in2);
Chris@16 413 e.assign(in1, in2, m_flags);
Chris@16 414
Chris@16 415 // access:
Chris@16 416 const Regex ce;
Chris@16 417 typename Regex::size_type i = ce.mark_count();
Chris@16 418 ignore_unused_variable_warning(i);
Chris@16 419 m_flags = ce.flags();
Chris@16 420 e.imbue(ce.getloc());
Chris@16 421 e.swap(e1);
Chris@16 422
Chris@16 423 global_regex_namespace::swap(e, e1);
Chris@16 424
Chris@16 425 // sub_match:
Chris@16 426 BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::pair<BidiIterator, BidiIterator>, sub_match_type>::value));
Chris@16 427 typedef typename sub_match_type::value_type sub_value_type;
Chris@16 428 typedef typename sub_match_type::difference_type sub_diff_type;
Chris@16 429 typedef typename sub_match_type::iterator sub_iter_type;
Chris@16 430 BOOST_STATIC_ASSERT((::boost::is_same<sub_value_type, value_type>::value));
Chris@16 431 BOOST_STATIC_ASSERT((::boost::is_same<sub_iter_type, BidiIterator>::value));
Chris@16 432 bool b = m_sub.matched;
Chris@16 433 ignore_unused_variable_warning(b);
Chris@16 434 BidiIterator bi = m_sub.first;
Chris@16 435 ignore_unused_variable_warning(bi);
Chris@16 436 bi = m_sub.second;
Chris@16 437 ignore_unused_variable_warning(bi);
Chris@16 438 sub_diff_type diff = m_sub.length();
Chris@16 439 ignore_unused_variable_warning(diff);
Chris@16 440 // match_results tests:
Chris@16 441 typedef typename match_results_type::value_type mr_value_type;
Chris@16 442 typedef typename match_results_type::const_reference mr_const_reference;
Chris@16 443 typedef typename match_results_type::reference mr_reference;
Chris@16 444 typedef typename match_results_type::const_iterator mr_const_iterator;
Chris@16 445 typedef typename match_results_type::iterator mr_iterator;
Chris@16 446 typedef typename match_results_type::difference_type mr_difference_type;
Chris@16 447 typedef typename match_results_type::size_type mr_size_type;
Chris@16 448 typedef typename match_results_type::allocator_type mr_allocator_type;
Chris@16 449 typedef typename match_results_type::char_type mr_char_type;
Chris@16 450 typedef typename match_results_type::string_type mr_string_type;
Chris@16 451
Chris@16 452 match_results_type m1;
Chris@16 453 mr_allocator_type at;
Chris@16 454 match_results_type m2(at);
Chris@16 455 match_results_type m3(m1);
Chris@16 456 m1 = m2;
Chris@16 457
Chris@16 458 int ival = 0;
Chris@16 459
Chris@16 460 mr_size_type mrs = m_cresults.size();
Chris@16 461 ignore_unused_variable_warning(mrs);
Chris@16 462 mrs = m_cresults.max_size();
Chris@16 463 ignore_unused_variable_warning(mrs);
Chris@16 464 b = m_cresults.empty();
Chris@16 465 ignore_unused_variable_warning(b);
Chris@16 466 mr_difference_type mrd = m_cresults.length();
Chris@16 467 ignore_unused_variable_warning(mrd);
Chris@16 468 mrd = m_cresults.length(ival);
Chris@16 469 ignore_unused_variable_warning(mrd);
Chris@16 470 mrd = m_cresults.position();
Chris@16 471 ignore_unused_variable_warning(mrd);
Chris@16 472 mrd = m_cresults.position(mrs);
Chris@16 473 ignore_unused_variable_warning(mrd);
Chris@16 474
Chris@16 475 mr_const_reference mrcr = m_cresults[ival];
Chris@16 476 ignore_unused_variable_warning(mrcr);
Chris@16 477 mr_const_reference mrcr2 = m_cresults.prefix();
Chris@16 478 ignore_unused_variable_warning(mrcr2);
Chris@16 479 mr_const_reference mrcr3 = m_cresults.suffix();
Chris@16 480 ignore_unused_variable_warning(mrcr3);
Chris@16 481 mr_const_iterator mrci = m_cresults.begin();
Chris@16 482 ignore_unused_variable_warning(mrci);
Chris@16 483 mrci = m_cresults.end();
Chris@16 484 ignore_unused_variable_warning(mrci);
Chris@16 485
Chris@16 486 mr_allocator_type at2 = m_cresults.get_allocator();
Chris@16 487 m_results.swap(m_results);
Chris@16 488 global_regex_namespace::swap(m_results, m_results);
Chris@16 489
Chris@16 490 // regex_match:
Chris@16 491 b = global_regex_namespace::regex_match(m_in, m_in, m_results, e);
Chris@16 492 ignore_unused_variable_warning(b);
Chris@16 493 b = global_regex_namespace::regex_match(m_in, m_in, m_results, e, m_mft);
Chris@16 494 ignore_unused_variable_warning(b);
Chris@16 495 b = global_regex_namespace::regex_match(m_in, m_in, e);
Chris@16 496 ignore_unused_variable_warning(b);
Chris@16 497 b = global_regex_namespace::regex_match(m_in, m_in, e, m_mft);
Chris@16 498 ignore_unused_variable_warning(b);
Chris@16 499 b = global_regex_namespace::regex_match(m_pointer, m_pmatch, e);
Chris@16 500 ignore_unused_variable_warning(b);
Chris@16 501 b = global_regex_namespace::regex_match(m_pointer, m_pmatch, e, m_mft);
Chris@16 502 ignore_unused_variable_warning(b);
Chris@16 503 b = global_regex_namespace::regex_match(m_pointer, e);
Chris@16 504 ignore_unused_variable_warning(b);
Chris@16 505 b = global_regex_namespace::regex_match(m_pointer, e, m_mft);
Chris@16 506 ignore_unused_variable_warning(b);
Chris@16 507 // regex_search:
Chris@16 508 b = global_regex_namespace::regex_search(m_in, m_in, m_results, e);
Chris@16 509 ignore_unused_variable_warning(b);
Chris@16 510 b = global_regex_namespace::regex_search(m_in, m_in, m_results, e, m_mft);
Chris@16 511 ignore_unused_variable_warning(b);
Chris@16 512 b = global_regex_namespace::regex_search(m_in, m_in, e);
Chris@16 513 ignore_unused_variable_warning(b);
Chris@16 514 b = global_regex_namespace::regex_search(m_in, m_in, e, m_mft);
Chris@16 515 ignore_unused_variable_warning(b);
Chris@16 516 b = global_regex_namespace::regex_search(m_pointer, m_pmatch, e);
Chris@16 517 ignore_unused_variable_warning(b);
Chris@16 518 b = global_regex_namespace::regex_search(m_pointer, m_pmatch, e, m_mft);
Chris@16 519 ignore_unused_variable_warning(b);
Chris@16 520 b = global_regex_namespace::regex_search(m_pointer, e);
Chris@16 521 ignore_unused_variable_warning(b);
Chris@16 522 b = global_regex_namespace::regex_search(m_pointer, e, m_mft);
Chris@16 523 ignore_unused_variable_warning(b);
Chris@16 524
Chris@16 525 // regex_iterator:
Chris@16 526 typedef typename regex_iterator_type::regex_type rit_regex_type;
Chris@16 527 typedef typename regex_iterator_type::value_type rit_value_type;
Chris@16 528 typedef typename regex_iterator_type::difference_type rit_difference_type;
Chris@16 529 typedef typename regex_iterator_type::pointer rit_pointer;
Chris@16 530 typedef typename regex_iterator_type::reference rit_reference;
Chris@16 531 typedef typename regex_iterator_type::iterator_category rit_iterator_category;
Chris@16 532 BOOST_STATIC_ASSERT((::boost::is_same<rit_regex_type, Regex>::value));
Chris@16 533 BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_default_type>::value));
Chris@16 534 BOOST_STATIC_ASSERT((::boost::is_same<rit_difference_type, std::ptrdiff_t>::value));
Chris@16 535 BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_default_type*>::value));
Chris@16 536 BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_default_type&>::value));
Chris@16 537 BOOST_STATIC_ASSERT((::boost::is_convertible<rit_iterator_category*, std::forward_iterator_tag*>::value));
Chris@16 538 // this takes care of most of the checks needed:
Chris@16 539 function_requires<ForwardIteratorConcept<regex_iterator_type> >();
Chris@16 540 regex_iterator_type iter1(m_in, m_in, e);
Chris@16 541 ignore_unused_variable_warning(iter1);
Chris@16 542 regex_iterator_type iter2(m_in, m_in, e, m_mft);
Chris@16 543 ignore_unused_variable_warning(iter2);
Chris@16 544
Chris@16 545 // regex_token_iterator:
Chris@16 546 typedef typename regex_token_iterator_type::regex_type rtit_regex_type;
Chris@16 547 typedef typename regex_token_iterator_type::value_type rtit_value_type;
Chris@16 548 typedef typename regex_token_iterator_type::difference_type rtit_difference_type;
Chris@16 549 typedef typename regex_token_iterator_type::pointer rtit_pointer;
Chris@16 550 typedef typename regex_token_iterator_type::reference rtit_reference;
Chris@16 551 typedef typename regex_token_iterator_type::iterator_category rtit_iterator_category;
Chris@16 552 BOOST_STATIC_ASSERT((::boost::is_same<rtit_regex_type, Regex>::value));
Chris@16 553 BOOST_STATIC_ASSERT((::boost::is_same<rtit_value_type, sub_match_type>::value));
Chris@16 554 BOOST_STATIC_ASSERT((::boost::is_same<rtit_difference_type, std::ptrdiff_t>::value));
Chris@16 555 BOOST_STATIC_ASSERT((::boost::is_same<rtit_pointer, const sub_match_type*>::value));
Chris@16 556 BOOST_STATIC_ASSERT((::boost::is_same<rtit_reference, const sub_match_type&>::value));
Chris@16 557 BOOST_STATIC_ASSERT((::boost::is_convertible<rtit_iterator_category*, std::forward_iterator_tag*>::value));
Chris@16 558 // this takes care of most of the checks needed:
Chris@16 559 function_requires<ForwardIteratorConcept<regex_token_iterator_type> >();
Chris@16 560 regex_token_iterator_type ti1(m_in, m_in, e);
Chris@16 561 ignore_unused_variable_warning(ti1);
Chris@16 562 regex_token_iterator_type ti2(m_in, m_in, e, 0);
Chris@16 563 ignore_unused_variable_warning(ti2);
Chris@16 564 regex_token_iterator_type ti3(m_in, m_in, e, 0, m_mft);
Chris@16 565 ignore_unused_variable_warning(ti3);
Chris@16 566 std::vector<int> subs;
Chris@16 567 regex_token_iterator_type ti4(m_in, m_in, e, subs);
Chris@16 568 ignore_unused_variable_warning(ti4);
Chris@16 569 regex_token_iterator_type ti5(m_in, m_in, e, subs, m_mft);
Chris@16 570 ignore_unused_variable_warning(ti5);
Chris@16 571 static const int i_array[3] = { 1, 2, 3, };
Chris@16 572 regex_token_iterator_type ti6(m_in, m_in, e, i_array);
Chris@16 573 ignore_unused_variable_warning(ti6);
Chris@16 574 regex_token_iterator_type ti7(m_in, m_in, e, i_array, m_mft);
Chris@16 575 ignore_unused_variable_warning(ti7);
Chris@16 576 }
Chris@16 577
Chris@16 578 pointer_type m_pointer;
Chris@16 579 flag_type m_flags;
Chris@16 580 std::size_t m_size;
Chris@16 581 input_iterator_type in1, in2;
Chris@16 582 const sub_match_type m_sub;
Chris@16 583 const value_type m_char;
Chris@16 584 match_results_type m_results;
Chris@16 585 const match_results_type m_cresults;
Chris@16 586 OutIterator m_out;
Chris@16 587 BidiIterator m_in;
Chris@16 588 global_regex_namespace::regex_constants::match_flag_type m_mft;
Chris@16 589 global_regex_namespace::match_results<
Chris@16 590 pointer_type,
Chris@16 591 allocator_architype<global_regex_namespace::sub_match<pointer_type> > >
Chris@16 592 m_pmatch;
Chris@16 593
Chris@16 594 BaseRegexConcept();
Chris@16 595 BaseRegexConcept(const BaseRegexConcept&);
Chris@16 596 BaseRegexConcept& operator=(const BaseRegexConcept&);
Chris@16 597 };
Chris@16 598
Chris@16 599 //
Chris@16 600 // RegexConcept:
Chris@16 601 // Test every interface in the std:
Chris@16 602 //
Chris@16 603 template <class Regex>
Chris@16 604 struct RegexConcept
Chris@16 605 {
Chris@16 606 typedef typename Regex::value_type value_type;
Chris@16 607 //typedef typename Regex::size_type size_type;
Chris@16 608 typedef typename Regex::flag_type flag_type;
Chris@16 609 typedef typename Regex::locale_type locale_type;
Chris@16 610
Chris@16 611 // derived test types:
Chris@16 612 typedef const value_type* pointer_type;
Chris@16 613 typedef std::basic_string<value_type> string_type;
Chris@16 614 typedef boost::bidirectional_iterator_archetype<value_type> BidiIterator;
Chris@16 615 typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
Chris@16 616 typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
Chris@16 617 typedef output_iterator_archetype<value_type> OutIterator;
Chris@16 618
Chris@16 619
Chris@16 620 void constraints()
Chris@16 621 {
Chris@16 622 function_requires<BaseRegexConcept<Regex> >();
Chris@16 623 // string based construct:
Chris@16 624 Regex e1(m_string);
Chris@16 625 ignore_unused_variable_warning(e1);
Chris@16 626 Regex e2(m_string, m_flags);
Chris@16 627 ignore_unused_variable_warning(e2);
Chris@16 628
Chris@16 629 // assign etc:
Chris@16 630 Regex e;
Chris@16 631 e = m_string;
Chris@16 632 e.assign(m_string);
Chris@16 633 e.assign(m_string, m_flags);
Chris@16 634
Chris@16 635 // sub_match:
Chris@16 636 string_type s(m_sub);
Chris@16 637 ignore_unused_variable_warning(s);
Chris@16 638 s = m_sub.str();
Chris@16 639 ignore_unused_variable_warning(s);
Chris@16 640 int i = m_sub.compare(m_string);
Chris@16 641 ignore_unused_variable_warning(i);
Chris@16 642
Chris@16 643 int i2 = m_sub.compare(m_sub);
Chris@16 644 ignore_unused_variable_warning(i2);
Chris@16 645 i2 = m_sub.compare(m_pointer);
Chris@16 646 ignore_unused_variable_warning(i2);
Chris@16 647
Chris@16 648 bool b = m_sub == m_sub;
Chris@16 649 ignore_unused_variable_warning(b);
Chris@16 650 b = m_sub != m_sub;
Chris@16 651 ignore_unused_variable_warning(b);
Chris@16 652 b = m_sub <= m_sub;
Chris@16 653 ignore_unused_variable_warning(b);
Chris@16 654 b = m_sub <= m_sub;
Chris@16 655 ignore_unused_variable_warning(b);
Chris@16 656 b = m_sub > m_sub;
Chris@16 657 ignore_unused_variable_warning(b);
Chris@16 658 b = m_sub >= m_sub;
Chris@16 659 ignore_unused_variable_warning(b);
Chris@16 660
Chris@16 661 b = m_sub == m_pointer;
Chris@16 662 ignore_unused_variable_warning(b);
Chris@16 663 b = m_sub != m_pointer;
Chris@16 664 ignore_unused_variable_warning(b);
Chris@16 665 b = m_sub <= m_pointer;
Chris@16 666 ignore_unused_variable_warning(b);
Chris@16 667 b = m_sub <= m_pointer;
Chris@16 668 ignore_unused_variable_warning(b);
Chris@16 669 b = m_sub > m_pointer;
Chris@16 670 ignore_unused_variable_warning(b);
Chris@16 671 b = m_sub >= m_pointer;
Chris@16 672 ignore_unused_variable_warning(b);
Chris@16 673
Chris@16 674 b = m_pointer == m_sub;
Chris@16 675 ignore_unused_variable_warning(b);
Chris@16 676 b = m_pointer != m_sub;
Chris@16 677 ignore_unused_variable_warning(b);
Chris@16 678 b = m_pointer <= m_sub;
Chris@16 679 ignore_unused_variable_warning(b);
Chris@16 680 b = m_pointer <= m_sub;
Chris@16 681 ignore_unused_variable_warning(b);
Chris@16 682 b = m_pointer > m_sub;
Chris@16 683 ignore_unused_variable_warning(b);
Chris@16 684 b = m_pointer >= m_sub;
Chris@16 685 ignore_unused_variable_warning(b);
Chris@16 686
Chris@16 687 b = m_sub == m_char;
Chris@16 688 ignore_unused_variable_warning(b);
Chris@16 689 b = m_sub != m_char;
Chris@16 690 ignore_unused_variable_warning(b);
Chris@16 691 b = m_sub <= m_char;
Chris@16 692 ignore_unused_variable_warning(b);
Chris@16 693 b = m_sub <= m_char;
Chris@16 694 ignore_unused_variable_warning(b);
Chris@16 695 b = m_sub > m_char;
Chris@16 696 ignore_unused_variable_warning(b);
Chris@16 697 b = m_sub >= m_char;
Chris@16 698 ignore_unused_variable_warning(b);
Chris@16 699
Chris@16 700 b = m_char == m_sub;
Chris@16 701 ignore_unused_variable_warning(b);
Chris@16 702 b = m_char != m_sub;
Chris@16 703 ignore_unused_variable_warning(b);
Chris@16 704 b = m_char <= m_sub;
Chris@16 705 ignore_unused_variable_warning(b);
Chris@16 706 b = m_char <= m_sub;
Chris@16 707 ignore_unused_variable_warning(b);
Chris@16 708 b = m_char > m_sub;
Chris@16 709 ignore_unused_variable_warning(b);
Chris@16 710 b = m_char >= m_sub;
Chris@16 711 ignore_unused_variable_warning(b);
Chris@16 712
Chris@16 713 b = m_sub == m_string;
Chris@16 714 ignore_unused_variable_warning(b);
Chris@16 715 b = m_sub != m_string;
Chris@16 716 ignore_unused_variable_warning(b);
Chris@16 717 b = m_sub <= m_string;
Chris@16 718 ignore_unused_variable_warning(b);
Chris@16 719 b = m_sub <= m_string;
Chris@16 720 ignore_unused_variable_warning(b);
Chris@16 721 b = m_sub > m_string;
Chris@16 722 ignore_unused_variable_warning(b);
Chris@16 723 b = m_sub >= m_string;
Chris@16 724 ignore_unused_variable_warning(b);
Chris@16 725
Chris@16 726 b = m_string == m_sub;
Chris@16 727 ignore_unused_variable_warning(b);
Chris@16 728 b = m_string != m_sub;
Chris@16 729 ignore_unused_variable_warning(b);
Chris@16 730 b = m_string <= m_sub;
Chris@16 731 ignore_unused_variable_warning(b);
Chris@16 732 b = m_string <= m_sub;
Chris@16 733 ignore_unused_variable_warning(b);
Chris@16 734 b = m_string > m_sub;
Chris@16 735 ignore_unused_variable_warning(b);
Chris@16 736 b = m_string >= m_sub;
Chris@16 737 ignore_unused_variable_warning(b);
Chris@16 738
Chris@16 739 // match results:
Chris@16 740 m_string = m_results.str();
Chris@16 741 ignore_unused_variable_warning(m_string);
Chris@16 742 m_string = m_results.str(0);
Chris@16 743 ignore_unused_variable_warning(m_string);
Chris@16 744 m_out = m_cresults.format(m_out, m_string);
Chris@16 745 m_out = m_cresults.format(m_out, m_string, m_mft);
Chris@16 746 m_string = m_cresults.format(m_string);
Chris@16 747 ignore_unused_variable_warning(m_string);
Chris@16 748 m_string = m_cresults.format(m_string, m_mft);
Chris@16 749 ignore_unused_variable_warning(m_string);
Chris@16 750
Chris@16 751 // regex_match:
Chris@16 752 b = global_regex_namespace::regex_match(m_string, m_smatch, e);
Chris@16 753 ignore_unused_variable_warning(b);
Chris@16 754 b = global_regex_namespace::regex_match(m_string, m_smatch, e, m_mft);
Chris@16 755 ignore_unused_variable_warning(b);
Chris@16 756 b = global_regex_namespace::regex_match(m_string, e);
Chris@16 757 ignore_unused_variable_warning(b);
Chris@16 758 b = global_regex_namespace::regex_match(m_string, e, m_mft);
Chris@16 759 ignore_unused_variable_warning(b);
Chris@16 760
Chris@16 761 // regex_search:
Chris@16 762 b = global_regex_namespace::regex_search(m_string, m_smatch, e);
Chris@16 763 ignore_unused_variable_warning(b);
Chris@16 764 b = global_regex_namespace::regex_search(m_string, m_smatch, e, m_mft);
Chris@16 765 ignore_unused_variable_warning(b);
Chris@16 766 b = global_regex_namespace::regex_search(m_string, e);
Chris@16 767 ignore_unused_variable_warning(b);
Chris@16 768 b = global_regex_namespace::regex_search(m_string, e, m_mft);
Chris@16 769 ignore_unused_variable_warning(b);
Chris@16 770
Chris@16 771 // regex_replace:
Chris@16 772 m_out = global_regex_namespace::regex_replace(m_out, m_in, m_in, e, m_string, m_mft);
Chris@16 773 m_out = global_regex_namespace::regex_replace(m_out, m_in, m_in, e, m_string);
Chris@16 774 m_string = global_regex_namespace::regex_replace(m_string, e, m_string, m_mft);
Chris@16 775 ignore_unused_variable_warning(m_string);
Chris@16 776 m_string = global_regex_namespace::regex_replace(m_string, e, m_string);
Chris@16 777 ignore_unused_variable_warning(m_string);
Chris@16 778
Chris@16 779 }
Chris@16 780
Chris@16 781 flag_type m_flags;
Chris@16 782 string_type m_string;
Chris@16 783 const sub_match_type m_sub;
Chris@16 784 match_results_type m_results;
Chris@16 785 pointer_type m_pointer;
Chris@16 786 value_type m_char;
Chris@16 787 const match_results_type m_cresults;
Chris@16 788 OutIterator m_out;
Chris@16 789 BidiIterator m_in;
Chris@16 790 global_regex_namespace::regex_constants::match_flag_type m_mft;
Chris@16 791 global_regex_namespace::match_results<typename string_type::const_iterator, allocator_architype<global_regex_namespace::sub_match<typename string_type::const_iterator> > > m_smatch;
Chris@16 792
Chris@16 793 RegexConcept();
Chris@16 794 RegexConcept(const RegexConcept&);
Chris@16 795 RegexConcept& operator=(const RegexConcept&);
Chris@16 796 };
Chris@16 797
Chris@16 798 #ifndef BOOST_REGEX_TEST_STD
Chris@16 799
Chris@16 800 template <class M>
Chris@16 801 struct functor1
Chris@16 802 {
Chris@16 803 typedef typename M::char_type char_type;
Chris@16 804 const char_type* operator()(const M&)const
Chris@16 805 {
Chris@16 806 static const char_type c = static_cast<char_type>(0);
Chris@16 807 return &c;
Chris@16 808 }
Chris@16 809 };
Chris@16 810 template <class M>
Chris@16 811 struct functor1b
Chris@16 812 {
Chris@16 813 typedef typename M::char_type char_type;
Chris@16 814 std::vector<char_type> operator()(const M&)const
Chris@16 815 {
Chris@16 816 static const std::vector<char_type> c;
Chris@16 817 return c;
Chris@16 818 }
Chris@16 819 };
Chris@16 820 template <class M>
Chris@16 821 struct functor2
Chris@16 822 {
Chris@16 823 template <class O>
Chris@16 824 O operator()(const M& /*m*/, O i)const
Chris@16 825 {
Chris@16 826 return i;
Chris@16 827 }
Chris@16 828 };
Chris@16 829 template <class M>
Chris@16 830 struct functor3
Chris@16 831 {
Chris@16 832 template <class O>
Chris@16 833 O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)const
Chris@16 834 {
Chris@16 835 return i;
Chris@16 836 }
Chris@16 837 };
Chris@16 838
Chris@16 839 //
Chris@16 840 // BoostRegexConcept:
Chris@16 841 // Test every interface in the Boost implementation:
Chris@16 842 //
Chris@16 843 template <class Regex>
Chris@16 844 struct BoostRegexConcept
Chris@16 845 {
Chris@16 846 typedef typename Regex::value_type value_type;
Chris@16 847 typedef typename Regex::size_type size_type;
Chris@16 848 typedef typename Regex::flag_type flag_type;
Chris@16 849 typedef typename Regex::locale_type locale_type;
Chris@16 850
Chris@16 851 // derived test types:
Chris@16 852 typedef const value_type* pointer_type;
Chris@16 853 typedef std::basic_string<value_type> string_type;
Chris@16 854 typedef typename Regex::const_iterator const_iterator;
Chris@16 855 typedef bidirectional_iterator_archetype<value_type> BidiIterator;
Chris@16 856 typedef output_iterator_archetype<value_type> OutputIterator;
Chris@16 857 typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
Chris@16 858 typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
Chris@16 859 typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
Chris@16 860
Chris@16 861 void constraints()
Chris@16 862 {
Chris@16 863 global_regex_namespace::regex_constants::match_flag_type mopts
Chris@16 864 = global_regex_namespace::regex_constants::match_default
Chris@16 865 | global_regex_namespace::regex_constants::match_not_bol
Chris@16 866 | global_regex_namespace::regex_constants::match_not_eol
Chris@16 867 | global_regex_namespace::regex_constants::match_not_bow
Chris@16 868 | global_regex_namespace::regex_constants::match_not_eow
Chris@16 869 | global_regex_namespace::regex_constants::match_any
Chris@16 870 | global_regex_namespace::regex_constants::match_not_null
Chris@16 871 | global_regex_namespace::regex_constants::match_continuous
Chris@16 872 | global_regex_namespace::regex_constants::match_partial
Chris@16 873 | global_regex_namespace::regex_constants::match_prev_avail
Chris@16 874 | global_regex_namespace::regex_constants::format_default
Chris@16 875 | global_regex_namespace::regex_constants::format_sed
Chris@16 876 | global_regex_namespace::regex_constants::format_perl
Chris@16 877 | global_regex_namespace::regex_constants::format_no_copy
Chris@16 878 | global_regex_namespace::regex_constants::format_first_only;
Chris@16 879
Chris@16 880 (void)mopts;
Chris@16 881
Chris@16 882 function_requires<RegexConcept<Regex> >();
Chris@16 883 const global_regex_namespace::regex_error except(global_regex_namespace::regex_constants::error_collate);
Chris@16 884 std::ptrdiff_t pt = except.position();
Chris@16 885 ignore_unused_variable_warning(pt);
Chris@16 886 const Regex ce, ce2;
Chris@16 887 #ifndef BOOST_NO_STD_LOCALE
Chris@16 888 m_stream << ce;
Chris@16 889 #endif
Chris@16 890 unsigned i = ce.error_code();
Chris@16 891 ignore_unused_variable_warning(i);
Chris@16 892 pointer_type p = ce.expression();
Chris@16 893 ignore_unused_variable_warning(p);
Chris@16 894 int i2 = ce.compare(ce2);
Chris@16 895 ignore_unused_variable_warning(i2);
Chris@16 896 bool b = ce == ce2;
Chris@16 897 ignore_unused_variable_warning(b);
Chris@16 898 b = ce.empty();
Chris@16 899 ignore_unused_variable_warning(b);
Chris@16 900 b = ce != ce2;
Chris@16 901 ignore_unused_variable_warning(b);
Chris@16 902 b = ce < ce2;
Chris@16 903 ignore_unused_variable_warning(b);
Chris@16 904 b = ce > ce2;
Chris@16 905 ignore_unused_variable_warning(b);
Chris@16 906 b = ce <= ce2;
Chris@16 907 ignore_unused_variable_warning(b);
Chris@16 908 b = ce >= ce2;
Chris@16 909 ignore_unused_variable_warning(b);
Chris@16 910 i = ce.status();
Chris@16 911 ignore_unused_variable_warning(i);
Chris@16 912 size_type s = ce.max_size();
Chris@16 913 ignore_unused_variable_warning(s);
Chris@16 914 s = ce.size();
Chris@16 915 ignore_unused_variable_warning(s);
Chris@16 916 const_iterator pi = ce.begin();
Chris@16 917 ignore_unused_variable_warning(pi);
Chris@16 918 pi = ce.end();
Chris@16 919 ignore_unused_variable_warning(pi);
Chris@16 920 string_type s2 = ce.str();
Chris@16 921 ignore_unused_variable_warning(s2);
Chris@16 922
Chris@16 923 m_string = m_sub + m_sub;
Chris@16 924 ignore_unused_variable_warning(m_string);
Chris@16 925 m_string = m_sub + m_pointer;
Chris@16 926 ignore_unused_variable_warning(m_string);
Chris@16 927 m_string = m_pointer + m_sub;
Chris@16 928 ignore_unused_variable_warning(m_string);
Chris@16 929 m_string = m_sub + m_string;
Chris@16 930 ignore_unused_variable_warning(m_string);
Chris@16 931 m_string = m_string + m_sub;
Chris@16 932 ignore_unused_variable_warning(m_string);
Chris@16 933 m_string = m_sub + m_char;
Chris@16 934 ignore_unused_variable_warning(m_string);
Chris@16 935 m_string = m_char + m_sub;
Chris@16 936 ignore_unused_variable_warning(m_string);
Chris@16 937
Chris@16 938 // Named sub-expressions:
Chris@16 939 m_sub = m_cresults[&m_char];
Chris@16 940 ignore_unused_variable_warning(m_sub);
Chris@16 941 m_sub = m_cresults[m_string];
Chris@16 942 ignore_unused_variable_warning(m_sub);
Chris@16 943 m_sub = m_cresults[""];
Chris@16 944 ignore_unused_variable_warning(m_sub);
Chris@16 945 m_sub = m_cresults[std::string("")];
Chris@16 946 ignore_unused_variable_warning(m_sub);
Chris@16 947 m_string = m_cresults.str(&m_char);
Chris@16 948 ignore_unused_variable_warning(m_string);
Chris@16 949 m_string = m_cresults.str(m_string);
Chris@16 950 ignore_unused_variable_warning(m_string);
Chris@16 951 m_string = m_cresults.str("");
Chris@16 952 ignore_unused_variable_warning(m_string);
Chris@16 953 m_string = m_cresults.str(std::string(""));
Chris@16 954 ignore_unused_variable_warning(m_string);
Chris@16 955
Chris@16 956 typename match_results_type::difference_type diff;
Chris@16 957 diff = m_cresults.length(&m_char);
Chris@16 958 ignore_unused_variable_warning(diff);
Chris@16 959 diff = m_cresults.length(m_string);
Chris@16 960 ignore_unused_variable_warning(diff);
Chris@16 961 diff = m_cresults.length("");
Chris@16 962 ignore_unused_variable_warning(diff);
Chris@16 963 diff = m_cresults.length(std::string(""));
Chris@16 964 ignore_unused_variable_warning(diff);
Chris@16 965 diff = m_cresults.position(&m_char);
Chris@16 966 ignore_unused_variable_warning(diff);
Chris@16 967 diff = m_cresults.position(m_string);
Chris@16 968 ignore_unused_variable_warning(diff);
Chris@16 969 diff = m_cresults.position("");
Chris@16 970 ignore_unused_variable_warning(diff);
Chris@16 971 diff = m_cresults.position(std::string(""));
Chris@16 972 ignore_unused_variable_warning(diff);
Chris@16 973
Chris@16 974 #ifndef BOOST_NO_STD_LOCALE
Chris@16 975 m_stream << m_sub;
Chris@16 976 m_stream << m_cresults;
Chris@16 977 #endif
Chris@16 978 //
Chris@16 979 // Extended formatting with a functor:
Chris@16 980 //
Chris@16 981 regex_constants::match_flag_type f = regex_constants::match_default;
Chris@16 982 OutputIterator out = static_object<OutputIterator>::get();
Chris@16 983
Chris@16 984 functor3<match_results_default_type> func3;
Chris@16 985 functor2<match_results_default_type> func2;
Chris@16 986 functor1<match_results_default_type> func1;
Chris@16 987
Chris@16 988 functor3<match_results_type> func3b;
Chris@16 989 functor2<match_results_type> func2b;
Chris@16 990 functor1<match_results_type> func1b;
Chris@16 991
Chris@16 992 out = regex_format(out, m_cresults, func3b, f);
Chris@16 993 out = regex_format(out, m_cresults, func3b);
Chris@16 994 out = regex_format(out, m_cresults, func2b, f);
Chris@16 995 out = regex_format(out, m_cresults, func2b);
Chris@16 996 out = regex_format(out, m_cresults, func1b, f);
Chris@16 997 out = regex_format(out, m_cresults, func1b);
Chris@16 998 out = regex_format(out, m_cresults, boost::ref(func3b), f);
Chris@16 999 out = regex_format(out, m_cresults, boost::ref(func3b));
Chris@16 1000 out = regex_format(out, m_cresults, boost::ref(func2b), f);
Chris@16 1001 out = regex_format(out, m_cresults, boost::ref(func2b));
Chris@16 1002 out = regex_format(out, m_cresults, boost::ref(func1b), f);
Chris@16 1003 out = regex_format(out, m_cresults, boost::ref(func1b));
Chris@16 1004 out = regex_format(out, m_cresults, boost::cref(func3b), f);
Chris@16 1005 out = regex_format(out, m_cresults, boost::cref(func3b));
Chris@16 1006 out = regex_format(out, m_cresults, boost::cref(func2b), f);
Chris@16 1007 out = regex_format(out, m_cresults, boost::cref(func2b));
Chris@16 1008 out = regex_format(out, m_cresults, boost::cref(func1b), f);
Chris@16 1009 out = regex_format(out, m_cresults, boost::cref(func1b));
Chris@16 1010
Chris@16 1011 m_string += regex_format(m_cresults, func3b, f);
Chris@16 1012 m_string += regex_format(m_cresults, func3b);
Chris@16 1013 m_string += regex_format(m_cresults, func2b, f);
Chris@16 1014 m_string += regex_format(m_cresults, func2b);
Chris@16 1015 m_string += regex_format(m_cresults, func1b, f);
Chris@16 1016 m_string += regex_format(m_cresults, func1b);
Chris@16 1017 m_string += regex_format(m_cresults, boost::ref(func3b), f);
Chris@16 1018 m_string += regex_format(m_cresults, boost::ref(func3b));
Chris@16 1019 m_string += regex_format(m_cresults, boost::ref(func2b), f);
Chris@16 1020 m_string += regex_format(m_cresults, boost::ref(func2b));
Chris@16 1021 m_string += regex_format(m_cresults, boost::ref(func1b), f);
Chris@16 1022 m_string += regex_format(m_cresults, boost::ref(func1b));
Chris@16 1023 m_string += regex_format(m_cresults, boost::cref(func3b), f);
Chris@16 1024 m_string += regex_format(m_cresults, boost::cref(func3b));
Chris@16 1025 m_string += regex_format(m_cresults, boost::cref(func2b), f);
Chris@16 1026 m_string += regex_format(m_cresults, boost::cref(func2b));
Chris@16 1027 m_string += regex_format(m_cresults, boost::cref(func1b), f);
Chris@16 1028 m_string += regex_format(m_cresults, boost::cref(func1b));
Chris@16 1029
Chris@16 1030 out = m_cresults.format(out, func3b, f);
Chris@16 1031 out = m_cresults.format(out, func3b);
Chris@16 1032 out = m_cresults.format(out, func2b, f);
Chris@16 1033 out = m_cresults.format(out, func2b);
Chris@16 1034 out = m_cresults.format(out, func1b, f);
Chris@16 1035 out = m_cresults.format(out, func1b);
Chris@16 1036 out = m_cresults.format(out, boost::ref(func3b), f);
Chris@16 1037 out = m_cresults.format(out, boost::ref(func3b));
Chris@16 1038 out = m_cresults.format(out, boost::ref(func2b), f);
Chris@16 1039 out = m_cresults.format(out, boost::ref(func2b));
Chris@16 1040 out = m_cresults.format(out, boost::ref(func1b), f);
Chris@16 1041 out = m_cresults.format(out, boost::ref(func1b));
Chris@16 1042 out = m_cresults.format(out, boost::cref(func3b), f);
Chris@16 1043 out = m_cresults.format(out, boost::cref(func3b));
Chris@16 1044 out = m_cresults.format(out, boost::cref(func2b), f);
Chris@16 1045 out = m_cresults.format(out, boost::cref(func2b));
Chris@16 1046 out = m_cresults.format(out, boost::cref(func1b), f);
Chris@16 1047 out = m_cresults.format(out, boost::cref(func1b));
Chris@16 1048
Chris@16 1049 m_string += m_cresults.format(func3b, f);
Chris@16 1050 m_string += m_cresults.format(func3b);
Chris@16 1051 m_string += m_cresults.format(func2b, f);
Chris@16 1052 m_string += m_cresults.format(func2b);
Chris@16 1053 m_string += m_cresults.format(func1b, f);
Chris@16 1054 m_string += m_cresults.format(func1b);
Chris@16 1055 m_string += m_cresults.format(boost::ref(func3b), f);
Chris@16 1056 m_string += m_cresults.format(boost::ref(func3b));
Chris@16 1057 m_string += m_cresults.format(boost::ref(func2b), f);
Chris@16 1058 m_string += m_cresults.format(boost::ref(func2b));
Chris@16 1059 m_string += m_cresults.format(boost::ref(func1b), f);
Chris@16 1060 m_string += m_cresults.format(boost::ref(func1b));
Chris@16 1061 m_string += m_cresults.format(boost::cref(func3b), f);
Chris@16 1062 m_string += m_cresults.format(boost::cref(func3b));
Chris@16 1063 m_string += m_cresults.format(boost::cref(func2b), f);
Chris@16 1064 m_string += m_cresults.format(boost::cref(func2b));
Chris@16 1065 m_string += m_cresults.format(boost::cref(func1b), f);
Chris@16 1066 m_string += m_cresults.format(boost::cref(func1b));
Chris@16 1067
Chris@16 1068 out = regex_replace(out, m_in, m_in, ce, func3, f);
Chris@16 1069 out = regex_replace(out, m_in, m_in, ce, func3);
Chris@16 1070 out = regex_replace(out, m_in, m_in, ce, func2, f);
Chris@16 1071 out = regex_replace(out, m_in, m_in, ce, func2);
Chris@16 1072 out = regex_replace(out, m_in, m_in, ce, func1, f);
Chris@16 1073 out = regex_replace(out, m_in, m_in, ce, func1);
Chris@16 1074 out = regex_replace(out, m_in, m_in, ce, boost::ref(func3), f);
Chris@16 1075 out = regex_replace(out, m_in, m_in, ce, boost::ref(func3));
Chris@16 1076 out = regex_replace(out, m_in, m_in, ce, boost::ref(func2), f);
Chris@16 1077 out = regex_replace(out, m_in, m_in, ce, boost::ref(func2));
Chris@16 1078 out = regex_replace(out, m_in, m_in, ce, boost::ref(func1), f);
Chris@16 1079 out = regex_replace(out, m_in, m_in, ce, boost::ref(func1));
Chris@16 1080 out = regex_replace(out, m_in, m_in, ce, boost::cref(func3), f);
Chris@16 1081 out = regex_replace(out, m_in, m_in, ce, boost::cref(func3));
Chris@16 1082 out = regex_replace(out, m_in, m_in, ce, boost::cref(func2), f);
Chris@16 1083 out = regex_replace(out, m_in, m_in, ce, boost::cref(func2));
Chris@16 1084 out = regex_replace(out, m_in, m_in, ce, boost::cref(func1), f);
Chris@16 1085 out = regex_replace(out, m_in, m_in, ce, boost::cref(func1));
Chris@16 1086
Chris@16 1087 functor3<match_results<typename string_type::const_iterator> > func3s;
Chris@16 1088 functor2<match_results<typename string_type::const_iterator> > func2s;
Chris@16 1089 functor1<match_results<typename string_type::const_iterator> > func1s;
Chris@16 1090 m_string += regex_replace(m_string, ce, func3s, f);
Chris@16 1091 m_string += regex_replace(m_string, ce, func3s);
Chris@16 1092 m_string += regex_replace(m_string, ce, func2s, f);
Chris@16 1093 m_string += regex_replace(m_string, ce, func2s);
Chris@16 1094 m_string += regex_replace(m_string, ce, func1s, f);
Chris@16 1095 m_string += regex_replace(m_string, ce, func1s);
Chris@16 1096 m_string += regex_replace(m_string, ce, boost::ref(func3s), f);
Chris@16 1097 m_string += regex_replace(m_string, ce, boost::ref(func3s));
Chris@16 1098 m_string += regex_replace(m_string, ce, boost::ref(func2s), f);
Chris@16 1099 m_string += regex_replace(m_string, ce, boost::ref(func2s));
Chris@16 1100 m_string += regex_replace(m_string, ce, boost::ref(func1s), f);
Chris@16 1101 m_string += regex_replace(m_string, ce, boost::ref(func1s));
Chris@16 1102 m_string += regex_replace(m_string, ce, boost::cref(func3s), f);
Chris@16 1103 m_string += regex_replace(m_string, ce, boost::cref(func3s));
Chris@16 1104 m_string += regex_replace(m_string, ce, boost::cref(func2s), f);
Chris@16 1105 m_string += regex_replace(m_string, ce, boost::cref(func2s));
Chris@16 1106 m_string += regex_replace(m_string, ce, boost::cref(func1s), f);
Chris@16 1107 m_string += regex_replace(m_string, ce, boost::cref(func1s));
Chris@16 1108 }
Chris@16 1109
Chris@16 1110 std::basic_ostream<value_type> m_stream;
Chris@16 1111 sub_match_type m_sub;
Chris@16 1112 pointer_type m_pointer;
Chris@16 1113 string_type m_string;
Chris@16 1114 const value_type m_char;
Chris@16 1115 match_results_type m_results;
Chris@16 1116 const match_results_type m_cresults;
Chris@16 1117 BidiIterator m_in;
Chris@16 1118
Chris@16 1119 BoostRegexConcept();
Chris@16 1120 BoostRegexConcept(const BoostRegexConcept&);
Chris@16 1121 BoostRegexConcept& operator=(const BoostRegexConcept&);
Chris@16 1122 };
Chris@16 1123
Chris@16 1124 #endif // BOOST_REGEX_TEST_STD
Chris@16 1125
Chris@16 1126 }
Chris@16 1127
Chris@16 1128 #endif