Skip to content
Snippets Groups Projects
Commit 813f7bbe authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added method to find a keyword

This finds a keyword in a list without erasing it.
parent ef80e9af
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment