Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template regex_iterator

boost::xpressive::regex_iterator

Synopsis

// In header: <boost/xpressive/regex_iterator.hpp>

template<typename BidiIter> 
struct regex_iterator {
  // types
  typedef basic_regex< BidiIter >               regex_type;       
  typedef match_results< BidiIter >             value_type;       
  typedef iterator_difference< BidiIter >::type difference_type;  
  typedef value_type const *                    pointer;          
  typedef value_type const &                    reference;        
  typedef std::forward_iterator_tag             iterator_category;

  // construct/copy/destruct
  regex_iterator();
  regex_iterator(BidiIter, BidiIter, basic_regex< BidiIter > const &, 
                 regex_constants::match_flag_type = regex_constants::match_default);
  template<typename LetExpr> 
    regex_iterator(BidiIter, BidiIter, basic_regex< BidiIter > const &, 
                   unspecified, 
                   regex_constants::match_flag_type = regex_constants::match_default);
  regex_iterator(regex_iterator< BidiIter > const &);
  regex_iterator& operator=(regex_iterator< BidiIter > const &);

  // public member functions
  value_type const & operator*() const;
  value_type const * operator->() const;
  regex_iterator< BidiIter > & operator++();
  regex_iterator< BidiIter > operator++(int);
};

Description

regex_iterator public construct/copy/destruct

  1. regex_iterator();
  2. regex_iterator(BidiIter begin, BidiIter end, 
                   basic_regex< BidiIter > const & rex, 
                   regex_constants::match_flag_type flags = regex_constants::match_default);
  3. template<typename LetExpr> 
      regex_iterator(BidiIter begin, BidiIter end, 
                     basic_regex< BidiIter > const & rex, unspecified args, 
                     regex_constants::match_flag_type flags = regex_constants::match_default);
  4. regex_iterator(regex_iterator< BidiIter > const & that);
  5. regex_iterator& operator=(regex_iterator< BidiIter > const & that);

regex_iterator public member functions

  1. value_type const & operator*() const;
  2. value_type const * operator->() const;
  3. regex_iterator< BidiIter > & operator++();

    If what.prefix().first != what[0].second and if the element match_prev_avail is not set in flags then sets it. Then behaves as if by calling regex_search(what[0].second, end, what, *pre, flags), with the following variation: in the event that the previous match found was of zero length (what[0].length() == 0) then attempts to find a non-zero length match starting at what[0].second, only if that fails and provided what[0].second != suffix().second does it look for a (possibly zero length) match starting from what[0].second + 1. If no further match is found then sets this equal to the end of sequence iterator.

    Postconditions:

    (*this)->size() == pre->mark_count() + 1

    (*this)->empty() == false

    (*this)->prefix().first == An iterator denoting the end point of the previous match found

    (*this)->prefix().last == (**this)[0].first

    (*this)->prefix().matched == (*this)->prefix().first != (*this)->prefix().second

    (*this)->suffix().first == (**this)[0].second

    (*this)->suffix().last == end

    (*this)->suffix().matched == (*this)->suffix().first != (*this)->suffix().second

    (**this)[0].first == The starting iterator for this match.

    (**this)[0].second == The ending iterator for this match.

    (**this)[0].matched == true if a full match was found, and false if it was a partial match (found as a result of the match_partial flag being set).

    (**this)[n].first == For all integers n < (*this)->size(), the start of the sequence that matched sub-expression n. Alternatively, if sub-expression n did not participate in the match, then end.

    (**this)[n].second == For all integers n < (*this)->size(), the end of the sequence that matched sub-expression n. Alternatively, if sub-expression n did not participate in the match, then end.

    (**this)[n].matched == For all integers n < (*this)->size(), true if sub-expression n participated in the match, false otherwise.

    (*this)->position() == The distance from the start of the original sequence being iterated, to the start of this match.

  4. regex_iterator< BidiIter > operator++(int);

PrevUpHomeNext