From 24f86a020ef6bbcafcf73d6416338009b637ea65 Mon Sep 17 00:00:00 2001 From: pierre-luc <pierre-luc.bacon@savoirfairelinux.com> Date: Mon, 7 Sep 2009 02:03:19 -0400 Subject: [PATCH] [#1744] Fix inconsistency in the finditer method from the last commit. --- sflphone-common/src/sip/Regex.cpp | 7 ++++--- sflphone-common/src/sip/Regex.h | 14 +++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sflphone-common/src/sip/Regex.cpp b/sflphone-common/src/sip/Regex.cpp index 6ccb881c97..ca898b6215 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 8babdcfdd1..8120e5e7c6 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: -- GitLab