X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstrings%2Fregmatch.cpp;h=0e702b5e9568c5a3e5a2dd9a3fc6b49dce1d402a;hp=f81be1a5225b09886579df8a92582078609b2a61;hb=f24e7b96e76b63c9b9b8a6bce4c7a9db64276ea8;hpb=b42ed73a1b241c0e93ee03c43c4584b41c549bac diff --git a/source/strings/regmatch.cpp b/source/strings/regmatch.cpp index f81be1a..0e702b5 100644 --- a/source/strings/regmatch.cpp +++ b/source/strings/regmatch.cpp @@ -1,32 +1,25 @@ -/* $Id$ - -This file is part of libmspstrings -Copyright © 2007 Mikko Rasa -Distributed under the LGPL -*/ - -#include +#include #include "regmatch.h" using namespace std; namespace Msp { -RegMatch::RegMatch(const string &str, const GroupArray &g): - groups(g) +RegMatch::RegMatch(const string &str, const vector &grps): + groups(grps) { - for(GroupArray::iterator i=groups.begin(); i!=groups.end(); ++i) - if(i->match) + for(Group &g: groups) + if(g.match) { - i->length = i->end-i->begin; - i->str = str.substr(i->begin, i->length); + g.length = g.end-g.begin; + g.str = str.substr(g.begin, g.length); } } const RegMatch::Group &RegMatch::group(unsigned i) const { if(i>=groups.size()) - throw InvalidParameterValue("Group index out of range"); + throw out_of_range("RegMatch::group"); return groups[i]; }