diff --git a/src/Tools.cpp b/src/Tools.cpp index 1b3cb6c016106bf3082a09f90ebe44f2f16b8d78..1587130e6940a259db9f0d993aff161899ab6dd8 100644 --- a/src/Tools.cpp +++ b/src/Tools.cpp @@ -132,5 +132,24 @@ void Tools::convert(int i,std::string & str){ str=ostr.str(); } +void Tools::interpretRanges(std::vector<std::string>&s){ + vector<string> news; + for(vector<string>::iterator p=s.begin();p!=s.end();p++){ + vector<string> words; + words=getWords(*p,"-"); + int a,b; + if(words.size()==2 && convert(words[0],a) && convert(words[1],b)){ + assert(b>=a); + for(int i=a;i<=b;i++){ + string ss; + convert(i,ss); + news.push_back(ss); + } + }else news.push_back(*p); + } + s=news; +} + + diff --git a/src/Tools.h b/src/Tools.h index 7ce0c193aa55c2fe18738ae35bc36db55a0541ed..7fefbdc317e32456d4efb09c2f2442fb77436747 100644 --- a/src/Tools.h +++ b/src/Tools.h @@ -53,6 +53,8 @@ public: static bool parseVector(std::vector<std::string>&line,const std::string&key,std::vector<T>&val); /// Find a keyword without arguments on the input line static bool parseFlag(std::vector<std::string>&line,const std::string&key,bool&val); +/// Interpret atom ranges + static void interpretRanges(std::vector<std::string>&); }; template <class T>