本文整理汇总了C++中Tokenizer::hasMoreTokens方法的典型用法代码示例。如果您正苦于以下问题:C++ Tokenizer::hasMoreTokens方法的具体用法?C++ Tokenizer::hasMoreTokens怎么用?C++ Tokenizer::hasMoreTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tokenizer
的用法示例。
在下文中一共展示了Tokenizer::hasMoreTokens方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeFunction
void Mapping::makeFunction(string Id, string GmshCommandList, string EssiCommand) {
Tokenizer str = Tokenizer(GmshCommandList,"|");
while(str.hasMoreTokens()) {
Semantics semantic = Semantics( str.nextToken(),EssiCommand);
semantic.setElementId(Id);
this->Function.insert(pair<string,Semantics> (semantic.getEssiTag(),semantic));
}
}
示例2: setMatchMode
void Semantics::setMatchMode(){
Tokenizer tknzr = Tokenizer(this->ElementId,"-");
this->ElementId = tknzr.nextToken();
string str= tknzr.currToken();
if(str.empty() || ((!isdigit(str[0])) && (str[0] != '-') && (str[0] != '+'))) this->MatchMode=false ;
char * p ;
strtol(str.c_str(), &p, 10) ;
this->MatchMode = (*p == 0) ;
while(tknzr.hasMoreTokens()){
this->SemanticsId = tknzr.nextToken();
break;
}
}
示例3: setEssiCommand
void Semantics::setEssiCommand(const string& Command){
int nofTokens = 0;
Tokenizer inpString = Tokenizer(Command," ") ;
string Ecommand = "";
string Fcommand = ""; // Filtered Command with spaces
while( inpString.hasMoreTokens()){
Fcommand = Fcommand + inpString.nextToken()+" ";
}
inpString.set(Fcommand,"{}");
nofTokens = inpString.countTokens()-1;
string prevTag = "variable";
while(inpString.hasMoreTokens() && nofTokens-->0){
string variable;
Tokenizer Var = Tokenizer(inpString.nextToken(),"#()= ,");
if(!(inpString.currToken()).compare(";")) break; // Termination Condition with ";"
if((inpString.currToken()).back()=='\\'){ // Escape sequence "\\"
Ecommand = Ecommand + inpString.currToken().substr(0,inpString.currToken().length()-1) +Fcommand.substr(inpString.currIndex()-1,1);
continue;
}
Ecommand = Ecommand + inpString.currToken() + "$";
Var.setMode(1);
Var.setcurrPos(inpString.currToken().length()-1);
string currTag = (Var.nextToken());
if (currTag.length()<=1)
variable = prevTag;
else{
variable = currTag;
prevTag= currTag;
}
set<string>::iterator it = this->EssiTagList.find(variable);
if (it != this->EssiTagList.end()) {
map<string,int>::iterator it = this->TagList.find(variable);
if (it != this->TagList.end()){
it->second=it->second+1;
variable = variable + "#" +to_string(it->second);
}
else{
this->TagList.insert(pair<string,int>(variable,1));
variable = variable + "#1";
}
this->NofTagVariables++;
}
this->VarList.push_back(variable);
this->EssiVarList.push_back(variable);
// inpString.setDelimiter("{}#()=");
}
Ecommand = Ecommand+inpString.nextToken();
this->EssiCommand = Ecommand;
this->NofEssiVariables = this->VarList.size();
}