diff --git a/sflphone-common/src/sip/Regex.cpp b/sflphone-common/src/sip/Regex.cpp index 6ccb881c97345060e57f76fe2d900be594d90bf0..ca898b621510d4431db1d382d9d656f866e62fa4 100644 --- a/sflphone-common/src/sip/Regex.cpp +++ b/sflphone-common/src/sip/Regex.cpp @@ -125,11 +125,12 @@ namespace sfl { return _outputVector; } - std::vector<std::string>::iterator Regex::finditer(const std::string& subject) + range Regex::finditer(const std::string& subject) { findall(subject); - std::vector<std::string>::iterator iter = _outputVector.begin(); - return iter; + std::vector<std::string>::iterator iterBegin = _outputVector.begin(); + std::vector<std::string>::iterator iterEnd = _outputVector.end(); + return range(iterBegin, iterEnd); } } diff --git a/sflphone-common/src/sip/Regex.h b/sflphone-common/src/sip/Regex.h index 8babdcfdd1280e1626174941caa882aaa48e085f..8120e5e7c654b4f310136ac378ea282f438d3125 100644 --- a/sflphone-common/src/sip/Regex.h +++ b/sflphone-common/src/sip/Regex.h @@ -25,6 +25,18 @@ namespace sfl { + /** + * While waiting for C++0x to come out + * Let's say that we have something like + * std::range + * + * Defines a pair of iterator over a vector of + * strings. The fist element corresponds to the + * begining of the vector, while the second is + * set to the end. + */ + typedef std::pair<std::vector<std::string>::iterator, std::vector<std::string>::iterator> range; + /** * Exception object that is throw when * an error occured while compiling the @@ -99,7 +111,7 @@ namespace sfl { * containing the substrings that * were matched. */ - std::vector<std::string>::iterator finditer(const std::string& subject); + range finditer(const std::string& subject); private: