Class template match_results<> holds the results of a regex_match() or a regex_search() as a collection of sub_match objects. More...
#include <xpressive_fwd.hpp>
Public Types | |
typedef iterator_value < BidiIter >::type | char_type |
typedef detail::string_type < char_type >::type | string_type |
typedef std::size_t | size_type |
typedef sub_match< BidiIter > | value_type |
typedef iterator_difference < BidiIter >::type | difference_type |
typedef value_type const & | reference |
typedef value_type const & | const_reference |
typedef detail::sub_match_vector < BidiIter >::iterator | iterator |
typedef detail::sub_match_vector < BidiIter >::const_iterator | const_iterator |
typedef detail::nested_results < BidiIter > | nested_results_type |
Public Member Functions | |
match_results () | |
match_results (match_results< BidiIter > const &that) | |
~match_results () | |
match_results< BidiIter > & | operator= (match_results< BidiIter > const &that) |
size_type | size () const |
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. More... | |
bool | empty () const |
Returns size() == 0. More... | |
difference_type | length (size_type sub=0) const |
Returns (*this)[sub].length(). More... | |
difference_type | position (size_type sub=0) const |
If !(*this)[sub].matched then returns -1. More... | |
string_type | str (size_type sub=0) const |
Returns (*this)[sub].str(). More... | |
template<typename Sub > | |
const_reference | operator[] (Sub const &sub) const |
Returns a reference to the sub_match object representing the sequence that matched marked sub-expression sub. More... | |
const_reference | prefix () const |
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. More... | |
const_reference | suffix () const |
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. More... | |
const_iterator | begin () const |
Returns a starting iterator that enumerates over all the marked sub-expression matches stored in *this. More... | |
const_iterator | end () const |
Returns a terminating iterator that enumerates over all the marked sub-expression matches stored in *this. More... | |
operator bool_type () const | |
Returns a true value if (*this)[0].matched, else returns a false value. More... | |
bool | operator! () const |
Returns true if empty() || !(*this)[0].matched, else returns false. More... | |
regex_id_type | regex_id () const |
Returns the id of the basic_regex object most recently used with this match_results object. More... | |
nested_results_type const & | nested_results () const |
Returns a Sequence of nested match_results elements. More... | |
template<typename Format , typename OutputIterator > | |
OutputIterator | format (OutputIterator out, Format const &fmt, regex_constants::match_flag_type flags=regex_constants::format_default, typename disable_if< detail::is_char_ptr< Format > >::type *=0) const |
If Format models ForwardRange or is a null-terminated string, this function copies the character sequence in fmt to OutputIterator out . More... | |
template<typename OutputIterator > | |
OutputIterator | format (OutputIterator out, char_type const *fmt, regex_constants::match_flag_type flags=regex_constants::format_default) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
template<typename Format , typename OutputIterator > | |
string_type | format (Format const &fmt, regex_constants::match_flag_type flags=regex_constants::format_default, typename disable_if< detail::is_char_ptr< Format > >::type *=0) const |
If Format models ForwardRange or is a null-terminated string, this function returns a copy of the character sequence fmt . More... | |
string_type | format (char_type const *fmt, regex_constants::match_flag_type flags=regex_constants::format_default) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | swap (match_results< BidiIter > &that) |
Swaps the contents of two match_results objects. More... | |
template<typename Arg > | |
match_results< BidiIter > & | let (Arg const &arg) |
TODO document me. More... | |
match_results< BidiIter > const & | operator() (regex_id_type regex_id, size_type index=0) const |
INTERNAL ONLY. More... | |
match_results< BidiIter > const & | operator() (basic_regex< BidiIter > const &rex, std::size_t index=0) const |
INTERNAL ONLY. More... | |
Friends | |
struct | detail::core_access< BidiIter > |
Class template match_results<> holds the results of a regex_match() or a regex_search() as a collection of sub_match objects.
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.
typedef iterator_value<BidiIter>::type boost::xpressive::match_results< BidiIter >::char_type |
typedef detail::sub_match_vector<BidiIter>::const_iterator boost::xpressive::match_results< BidiIter >::const_iterator |
typedef value_type const& boost::xpressive::match_results< BidiIter >::const_reference |
typedef iterator_difference<BidiIter>::type boost::xpressive::match_results< BidiIter >::difference_type |
typedef detail::sub_match_vector<BidiIter>::iterator boost::xpressive::match_results< BidiIter >::iterator |
typedef detail::nested_results<BidiIter> boost::xpressive::match_results< BidiIter >::nested_results_type |
typedef value_type const& boost::xpressive::match_results< BidiIter >::reference |
typedef std::size_t boost::xpressive::match_results< BidiIter >::size_type |
typedef detail::string_type<char_type>::type boost::xpressive::match_results< BidiIter >::string_type |
typedef sub_match<BidiIter> boost::xpressive::match_results< BidiIter >::value_type |
|
inline |
|
inline |
that | The match_results object to copy |
References std::fill(), boost::xpressive::match_results< BidiIter >::size(), and boost::xpressive::detail::results_extras< BidiIter >::sub_match_stack_.
|
inline |
|
inline |
Returns a starting iterator that enumerates over all the marked sub-expression matches stored in *this.
Referenced by boost::xpressive::match_results< BidiIter >::operator()().
|
inline |
Returns size() == 0.
References boost::xpressive::match_results< BidiIter >::size().
Referenced by boost::xpressive::match_results< BidiIter >::operator bool_type(), and boost::xpressive::match_results< BidiIter >::operator!().
|
inline |
Returns a terminating iterator that enumerates over all the marked sub-expression matches stored in *this.
Referenced by boost::xpressive::match_results< BidiIter >::operator()().
|
inline |
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<match_results<BidiIter>, OutputIterator, regex_constants::match_flag_type>
, this function returns fmt(*this, out, flags)
.
Otherwise, if Format
models Callable<match_results<BidiIter>, OutputIterator>
, this function returns fmt(*this, out)
.
Otherwise, if Format
models Callable<match_results<BidiIter> >
, this function returns std::copy(x.begin(), x.end(), out)
, where x
is the result of calling fmt(*this)
.
References boost::python::detail::arity().
Referenced by boost::xpressive::match_results< BidiIter >::format(), and boost::xpressive::detail::regex_replace_impl().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References boost::as_literal().
|
inline |
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<match_results<BidiIter>, OutputIterator, regex_constants::match_flag_type>
, this function returns a 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<match_results<BidiIter>, OutputIterator>
, this function returns a string_type
object x
populated by calling fmt(*this, out)
, where out
is a back_insert_iterator
into x
.
Otherwise, if Format
models Callable<match_results<BidiIter> >
, this function returns fmt(*this)
.
References boost::xpressive::match_results< BidiIter >::format().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References boost::xpressive::match_results< BidiIter >::format().
|
inline |
Returns (*this)[sub].length().
References boost::numeric::interval_lib::sub().
Referenced by boost::xpressive::detail::regex_replace_impl().
|
inline |
TODO document me.
References BOOST_MPL_ASSERT, boost::proto::left(), boost::proto::right(), and boost::proto::value().
|
inline |
Returns a Sequence of nested match_results elements.
|
inline |
Returns a true value if (*this)[0].matched, else returns a false value.
References boost::xpressive::match_results< BidiIter >::empty(), and boost::xpressive::matched.
|
inline |
Returns true if empty() || !(*this)[0].matched, else returns false.
References boost::xpressive::match_results< BidiIter >::empty().
|
inline |
INTERNAL ONLY.
References boost::xpressive::match_results< BidiIter >::begin(), and boost::xpressive::match_results< BidiIter >::end().
|
inline |
INTERNAL ONLY.
References boost::xpressive::basic_regex< BidiIter >::regex_id().
|
inline |
that | The match_results object to copy. |
References boost::xpressive::match_results< BidiIter >::swap().
|
inline |
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.
|
inline |
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]
References boost::fusion::distance(), boost::xpressive::first, and boost::numeric::interval_lib::sub().
|
inline |
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.
|
inline |
Returns the id of the basic_regex object most recently used with this match_results object.
Referenced by boost::xpressive::regex_id_filter_predicate< BidiIter >::operator()().
|
inline |
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.
Referenced by boost::xpressive::match_results< BidiIter >::empty(), and boost::xpressive::match_results< BidiIter >::match_results().
|
inline |
Returns (*this)[sub].str().
References boost::numeric::interval_lib::sub().
|
inline |
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.
|
inline |
Swaps the contents of two match_results objects.
Guaranteed not to throw.
that | The match_results object to swap with. |
nothrow |
References boost::intrusive_ptr< T >::swap(), boost::swap(), and boost::optional< T >::swap().
Referenced by boost::xpressive::match_results< BidiIter >::operator=().
|
friend |