~ubuntu-branches/ubuntu/dapper/boost/dapper

« back to all changes in this revision

Viewing changes to boost/regex/v4/u32regex_token_iterator.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli, Christophe Prud'homme, Domenico Andreoli
  • Date: 2006-01-11 11:11:42 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060111111142-xy6z1i5himlgu8iw
Tags: 1.33.1-2
[ Christophe Prud'homme ]
* Bug fix: "libboost-wave-dev: Dependency on libboost-filesystem-dev
  missing", thanks to Martin v . Löwis (Closes: #346367).

[ Domenico Andreoli ]
* boost/graph/topological_sort.hpp: removed name of unused parameter
  to prevent long compiler warning.  Closes: #347519.
* Applied patch from upstream CVS to fix parsing of valid options
  with a common root.  Closes: #345714.
* libboost-python-dev now correctly depends on python2.4-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
   match_results<BidirectionalIterator> what;   // current match
52
52
   BidirectionalIterator                end;    // end of search area
53
 
   const regex_type                     re;    // the expression
 
53
   BidirectionalIterator                base;   // start of search area
 
54
   const regex_type                     re;     // the expression
54
55
   match_flag_type                      flags;  // match flags
55
56
   value_type                           result; // the current string result
56
57
   int                                  N;      // the current sub-expression being enumerated
61
62
      : end(last), re(*p), flags(f){ subs.push_back(sub); }
62
63
   u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
63
64
      : end(last), re(*p), flags(f), subs(v){}
64
 
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
 
65
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 
66
      // can't reliably get this to work....
 
67
#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
65
68
      || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
66
69
      || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
67
70
      || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
91
94
 
92
95
   bool init(BidirectionalIterator first)
93
96
   {
 
97
      base = first;
94
98
      N = 0;
95
 
      if(u32regex_search(first, end, what, re, flags) == true)
 
99
      if(u32regex_search(first, end, what, re, flags, base) == true)
96
100
      {
97
101
         N = 0;
98
102
         result = ((subs[N] == -1) ? what.prefix() : what[(int)subs[N]]);
129
133
         result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
130
134
         return true;
131
135
      }
132
 
      if(what.prefix().first != what[0].second)
133
 
         flags |= match_prev_avail | regex_constants::match_not_bob;
 
136
      //if(what.prefix().first != what[0].second)
 
137
      //   flags |= match_prev_avail | regex_constants::match_not_bob;
134
138
      BidirectionalIterator last_end(what[0].second);
135
 
      if(u32regex_search(last_end, end, what, re, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags)))
 
139
      if(u32regex_search(last_end, end, what, re, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags), base))
136
140
      {
137
141
         N =0;
138
142
         result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
190
194
      if(!pdata->init(a))
191
195
         pdata.reset();
192
196
   }
193
 
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
 
197
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
 
198
      // can't reliably get this to work....
 
199
#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
194
200
      || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
195
201
      || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
196
202
      || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
284
290
template <class charT, class Traits, class Alloc>
285
291
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
286
292
{
287
 
   return u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
 
293
   typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
 
294
   return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
288
295
}
289
296
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
290
297
{
291
298
   return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
292
299
}
293
300
 
 
301
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
294
302
// construction from a reference to an array:
295
303
template <std::size_t N>
296
304
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
314
322
template <class charT, class Traits, class Alloc, std::size_t N>
315
323
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
316
324
{
317
 
   return u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
 
325
   typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
 
326
   return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
318
327
}
319
328
template <std::size_t N>
320
329
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
321
330
{
322
331
   return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
323
332
}
 
333
#endif // BOOST_MSVC < 1300
324
334
 
325
335
// construction from a vector of sub_match id's:
326
336
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
342
352
template <class charT, class Traits, class Alloc>
343
353
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
344
354
{
345
 
   return u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator>(p.begin(), p.end(), e, m);
 
355
   typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
 
356
   return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
346
357
}
347
358
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
348
359
{