#include <string>
#include <vector>
+#include <msp/core/mspcore_api.h>
namespace Msp {
matched by subregexes. These are ordered from left to right, by the opening
parenthesis of the subregex.
*/
-class RegMatch
+class MSPCORE_API RegMatch
{
public:
/**
{
typedef std::string::size_type size_type;
- bool match; //< Whether or not this group matched
- size_type begin; //< First offset of the match
- size_type end; //< One-past-last offset
- size_type length; //< Length of the match (end-begin)
- std::string str; //< The part of the string that matched
+ bool match = false; //< Whether or not this group matched
+ size_type begin; //< First offset of the match
+ size_type end; //< One-past-last offset
+ size_type length; //< Length of the match (end-begin)
+ std::string str; //< The part of the string that matched
- Group(): match(false) { }
- operator bool() const { return match; }
+ explicit operator bool() const { return match; }
};
- typedef std::vector<Group> GroupArray;
-
private:
- GroupArray groups;
+ std::vector<Group> groups;
public:
/** Constructs a RegMatch representing a non-match. */
- RegMatch() { }
+ RegMatch() = default;
/** Constructs a new RegMatch from a string and groups. The length and str
members of each group are computed and need not be set. Intended to be used
/** Shorthand for the group() function. */
const Group &operator[](unsigned i) const { return group(i); }
- operator bool() const { return !empty(); }
+ explicit operator bool() const { return !empty(); }
};
} // namespace Msp