diff --git a/src/tools/Tools.cpp b/src/tools/Tools.cpp index c143889a3c1007a5ef8e63d4bf4b9c7735135282..b51ed3781f2f4dd18d11246e799e207abf7fde57 100644 --- a/src/tools/Tools.cpp +++ b/src/tools/Tools.cpp @@ -321,5 +321,14 @@ bool Tools::startWith(const std::string & full,const std::string &start){ return (full.substr(0,start.length())==start); } +bool Tools::findKeyword(const std::vector<std::string>&line,const std::string&key){ + const std::string search(key+"="); + for(vector<string>::const_iterator p=line.begin();p!=line.end();++p){ + if(startWith(*p,search)) return true; + } + return false; +} + + } diff --git a/src/tools/Tools.h b/src/tools/Tools.h index dbe7f3ded0d22878125180815a4c32d53aa18bc3..bb9153adba7f84e9759497567f325076d723e885 100644 --- a/src/tools/Tools.h +++ b/src/tools/Tools.h @@ -110,6 +110,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); +/// Find a keyword on the input line, just reporting if it exists or not + static bool findKeyword(const std::vector<std::string>&line,const std::string&key); /// Interpret atom ranges static void interpretRanges(std::vector<std::string>&); /// Remove duplicates from a vector of type T