![]() |
Home | Libraries | People | FAQ | More |
boost::xpressive::match_results — Class template match_results<> holds the results of a regex_match() or a regex_search() as a collection of sub_match objects.
// In header: <boost/xpressive/match_results.hpp> template<typename BidiIter> struct match_results { // types typedef ; typedef ; typedef ; typedef sub_match< ; typedef ; typedef ; typedef ; typedef ; typedef ; typedef ; // construct/copy/destruct (); (match_results< ); match_results< (match_results< ); ~(); // public member functions () ; () ; ( = ) ; ( = ) ; ( = ) ; template<typename Sub> () ; () ; () ; () ; () ; () ; () ; () ; () ; template<typename Format, typename OutputIterator> (, , = , = ) ; template<typename OutputIterator> (, , = ) ; template<typename Format, typename OutputIterator> (, = , = ) ; (, = ) ; (match_results< ); template<typename Arg> match_results< (); };
Class template match_results<> denotes a collection of sequences representing the result of a regular expression match. Storage for the collection is allocated and freed as necessary by the member functions of class match_results<>.
The class template match_results<> conforms to the requirements of a Sequence, as specified in (lib.sequence.reqmts), except that only operations defined for const-qualified Sequences are supported.
match_results
public
construct/copy/destruct();
Postconditions: |
regex_id() == 0 |
Postconditions: |
size() == 0 |
Postconditions: |
empty() == true |
Postconditions: |
str() == string_type() |
(match_results< that);
Parameters: |
|
||
Postconditions: |
regex_id() == that.regex_id(). |
||
Postconditions: |
size() == that.size(). |
||
Postconditions: |
empty() == that.empty(). |
||
Postconditions: |
str(n) == that.str(n) for all positive integers n < that.size(). |
||
Postconditions: |
prefix() == that.prefix(). |
||
Postconditions: |
suffix() == that.suffix(). |
||
Postconditions: |
(*this)[n] == that[n] for all positive integers n < that.size(). |
||
Postconditions: |
length(n) == that.length(n) for all positive integers n < that.size(). |
||
Postconditions: |
position(n) == that.position(n) for all positive integers n < that.size(). |
match_results< (match_results< that);
Parameters: |
|
||
Postconditions: |
regex_id() == that.regex_id(). |
||
Postconditions: |
size() == that.size(). |
||
Postconditions: |
empty() == that.empty(). |
||
Postconditions: |
str(n) == that.str(n) for all positive integers n < that.size(). |
||
Postconditions: |
prefix() == that.prefix(). |
||
Postconditions: |
suffix() == that.suffix(). |
||
Postconditions: |
(*this)[n] == that[n] for all positive integers n < that.size(). |
||
Postconditions: |
length(n) == that.length(n) for all positive integers n < that.size(). |
||
Postconditions: |
position(n) == that.position(n) for all positive integers n < that.size(). |
~();
match_results
public member functions() ;
Returns one plus the number of marked sub-expressions in the regular expression that was matched if *this represents the result of a successful match. Otherwise returns 0.
() ;
Returns size() == 0.
( sub = ) ;
Returns (*this)[sub].length().
( sub = ) ;
If !(*this)[sub].matched then returns -1. Otherwise returns std::distance(base, (*this)[sub].first), where base is the start iterator of the sequence that was searched. [Note - unless this is part of a repeated search with a regex_iterator
then base is the same as prefix().first - end note]
( sub = ) ;
Returns (*this)[sub].str().
template<typename Sub> ( sub) ;
Returns a reference to the sub_match
object representing the sequence that matched marked sub-expression sub. If sub == 0 then returns a reference to a sub_match
object representing the sequence that matched the whole regular expression. If sub >= size() then returns a sub_match
object representing an unmatched sub-expression.
() ;
Returns a reference to the sub_match
object representing the character sequence from the start of the string being matched/searched, to the start of the match found.
Requires: |
(*this)[0].matched is true |
() ;
Returns a reference to the sub_match
object representing the character sequence from the end of the match found to the end of the string being matched/searched.
Requires: |
(*this)[0].matched is true |
() ;
Returns a starting iterator that enumerates over all the marked sub-expression matches stored in *this.
() ;
Returns a terminating iterator that enumerates over all the marked sub-expression matches stored in *this.
() ;
Returns a true value if (*this)[0].matched, else returns a false value.
() ;
Returns true if empty() || !(*this)[0].matched, else returns false.
() ;
Returns the id of the basic_regex
object most recently used with this match_results
object.
() ;
Returns a Sequence of nested match_results
elements.
template<typename Format, typename OutputIterator> ( out, fmt, flags = , = ) ;
If Format
models ForwardRange
or is a null-terminated string, this function copies the character sequence in fmt
to OutputIterator
out
. For each format specifier or escape sequence in fmt
, replace that sequence with either the character(s) it represents, or the sequence within *this
to which it refers. The bitmasks specified in flags determines what format specifiers or escape sequences are recognized. By default, this is the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
Otherwise, if Format
models Callable<
, this function returns match_results
<BidiIter>, OutputIterator, regex_constants::match_flag_type>fmt(*this, out, flags)
.
Otherwise, if Format
models Callable<
, this function returns match_results
<BidiIter>, OutputIterator>fmt(*this, out)
.
Otherwise, if Format
models Callable<
, this function returns match_results
<BidiIter> >std::copy(x.begin(), x.end(), out)
, where x
is the result of calling fmt(*this)
.
template<typename OutputIterator> ( out, fmt, flags = ) ;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename Format, typename OutputIterator> ( fmt, flags = , = ) ;
If Format
models ForwardRange
or is a null-terminated string, this function returns a copy of the character sequence fmt
. For each format specifier or escape sequence in fmt
, replace that sequence with either the character(s) it represents, or the sequence within *this
to which it refers. The bitmasks specified in flags
determines what format specifiers or escape sequences are recognized. By default this is the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace.
Otherwise, if Format
models Callable<
, this function returns a match_results
<BidiIter>, OutputIterator, regex_constants::match_flag_type>string_type
object x
populated by calling fmt(*this, out, flags)
, where out
is a back_insert_iterator
into x
.
Otherwise, if Format
models Callable<
, this function returns a match_results
<BidiIter>, OutputIterator>string_type
object x
populated by calling fmt(*this, out)
, where out
is a back_insert_iterator
into x
.
Otherwise, if Format
models Callable<
, this function returns match_results
<BidiIter> >fmt(*this)
.
( fmt, flags = ) ;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
(match_results< that);
Swaps the contents of two match_results
objects. Guaranteed not to throw.
Parameters: |
|
||
Postconditions: |
*this contains the sequence of matched sub-expressions that were in that, that contains the sequence of matched sub-expressions that were in *this. |
||
Throws: |
Will not throw. |
template<typename Arg> match_results< ( arg);
TODO document me