SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Stores Unicode regular expression match results. More...
#include <rw/i18n/RWURegexResult.h>
Public Member Functions | |
RWURegexResult (const RWURegexResult &source) | |
~RWURegexResult () | |
RWUConstStringIterator | begin (const RWUString &str, size_t matchID=0) const |
RWUConstStringIterator | end (const RWUString &str, size_t matchID=0) const |
size_t | getLength (size_t matchID=0) const |
size_t | getStart (size_t matchID=0) const |
operator bool () const | |
RWURegexResult & | operator= (const RWURegexResult &rhs) |
size_t | subCount () const |
RWUConstSubString | subString (const RWUString &str, size_t matchID=0) const |
RWURegexResult stores regular expression match results.
Instances of RWURegexResult are returned from the RWURegularExpression methods search() and matchAt(), and by RWURegexMatchIterator member operators operator*() and operator->(). These results can be used later to obtain details concerning the regular expression match.
This class has a conversion to bool
operator, which indicates whether the search() or matchAt() operation was, in fact, a match. Iterators to the beginning and ending of the overall match, or of a subexpression match, can be obtained.
Program output:
RWURegexResult::RWURegexResult | ( | const RWURegexResult & | source | ) |
Copy constructor. Creates a deep copy of source.
RWURegexResult::~RWURegexResult | ( | ) |
Destructor.
RWUConstStringIterator RWURegexResult::begin | ( | const RWUString & | str, |
size_t | matchID = 0 ) const |
Returns an iterator to the start of the requested match.
Returns an iterator to the match indicated by the specified match identifier matchID. The supplied string str must be the same RWUString instance used to generate self.
A match identifier of 0
requests the start of the entire match within the match string. Match identifiers greater than 0
request the starting index of matches against parenthesized subexpressions within the regular expression pattern. Match identifier 1
requests the start of the first subexpression match, 2
requests the second, and so on. Returns an iterator into the str if the specified match identifier corresponds to a match. If no match is associated with the specified match identifier then the end iterator is returned. Used in conjunction with getLength(), this method can be used to extract substrings representing regular expression matches.
RWUConstStringIterator RWURegexResult::end | ( | const RWUString & | str, |
size_t | matchID = 0 ) const |
Return an iterator just past the end of the requested match.
Returns the position immediately following the match indicated by the specified match identifier matchID. The supplied string str must be the same RWUString instance used to generate self.
A match identifier of 0
requests the end of the entire match within the match string. Match identifiers greater than 0
request the end position of matches against parenthesized subexpressions within the regular expression pattern. Match identifier 1
requests the start of the first subexpression match, 2
requests the second, and so on. Returns an iterator referencing the position just after the indicated match, which may be the end iterator. If no match is associated with the specified match identifier then the end iterator is returned.
size_t RWURegexResult::getLength | ( | size_t | matchID = 0 | ) | const |
Returns the length in code units of the requested match.
size_t RWURegexResult::getStart | ( | size_t | matchID = 0 | ) | const |
Returns the starting offset, in code units, of the requested match.
RWURegexResult::operator bool | ( | ) | const |
RWURegexResult & RWURegexResult::operator= | ( | const RWURegexResult & | rhs | ) |
Assignment operator. Creates a deep copy of rhs.
size_t RWURegexResult::subCount | ( | ) | const |
Number of sub-matches accessor. Returns the number of match IDs available for request, excluding the 0
match ID. This corresponds to the number of parenthesized sub-expressions contained in the pattern associated with the RWURegularExpression class that created self. Only match IDs that fall between 0
and subCount(), inclusive, can be used with self.
RWUConstSubString RWURegexResult::subString | ( | const RWUString & | str, |
size_t | matchID = 0 ) const |
Returns the const
substring for the requested match.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |