当前位置: 首页>>代码示例>>C++>>正文


C++ Tokenizer::currToken方法代码示例

本文整理汇总了C++中Tokenizer::currToken方法的典型用法代码示例。如果您正苦于以下问题:C++ Tokenizer::currToken方法的具体用法?C++ Tokenizer::currToken怎么用?C++ Tokenizer::currToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tokenizer的用法示例。


在下文中一共展示了Tokenizer::currToken方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
   	}
}
开发者ID:SumeetSinha,项目名称:gmESSI,代码行数:15,代码来源:Semantics.cpp

示例2: setGmshCommand

void Semantics::setGmshCommand(const string& Command){

	int nofTokens = 0;
	string Gcommand = "", essiTag="";
	Tokenizer inpString = Tokenizer(Command," {,;}()");
	nofTokens = inpString.countTokens()-1;
	this->NofGmshVariables = nofTokens-1;
	Gcommand = Gcommand + inpString.nextToken() + "{ ";
	essiTag = essiTag + inpString.currToken() + "{";
	
	for( int i=0 ;i<nofTokens-1; i++){

		string variable= this->delSpaces(inpString.nextToken());
		
		vector<string>::iterator it;
		it = find(this->VarList.begin(),this->VarList.end(),variable);
		
		if (it != this->VarList.end()) 
 			*it = "variable";

		Gcommand = Gcommand +variable+" ,";
		essiTag = essiTag + " ,";
	}

	string variable= this->delSpaces(inpString.nextToken());

	if(variable.compare("")){
		this->NofGmshVariables++;
	}

	vector<string>::iterator it;
	it = find(this->VarList.begin(),this->VarList.end(),variable);
	if (it != this->VarList.end()) 
 		*it = "variable";
 	
	Gcommand = Gcommand +variable + " }";
	essiTag = essiTag + " }"+to_string(this->NofGmshVariables);
	
	// cout << Gcommand << endl;
	// cout << essiTag << endl;
	this->GmshCommand= Gcommand;
	this->setEssiTag(essiTag);

}
开发者ID:SumeetSinha,项目名称:gmESSI,代码行数:44,代码来源:Semantics.cpp

示例3: mapFile

void Mapping::mapFile() {

    fstream mapFile(this->FileName, fstream::in);
    string line;

    while(getline(mapFile,line)) {

        Tokenizer str = Tokenizer(line,"#  \t\v\n\r\f");
        if(!delSpaces(str.nextToken()).compare("ELEMENT_ID"))
            break;
    }

    while(getline(mapFile,line)) {

        string strLine = delSpaces(line);
        Tokenizer str = Tokenizer(line,"#  \t\v\n\r\f\"");

        if(!str.nextToken().compare("ENDELEMENT_ID"))
            break;
        if(!str.currToken().substr(0,2).compare("//"))
            continue;
        if(delSpaces(str.currToken()).length()==0)
            continue;

        string elementDes="";
        string elementId = "";

        elementId = elementId + str.currToken();
        elementDes= elementDes + str.nextToken();
        str.setDelimiter("\"");
        elementDes= elementDes + str.nextToken();

        this->ElementMap.insert(pair<string,string>(elementId,elementDes));
    }

    while(getline(mapFile,line)) {

        Tokenizer str = Tokenizer(line,"#  \t\v\n\r\f");
        if(!delSpaces(str.nextToken()).compare("ESSI_TAGS"))
            break;
    }

    while(getline(mapFile,line)) {

        Tokenizer str = Tokenizer(line,"#  \t\v\n\r\f");
        if(!delSpaces(str.nextToken()).compare("ENDESSI_TAGS"))
            break;
        if(!delSpaces(str.currToken()).substr(0,2).compare("//"))
            continue;
        if(delSpaces(str.currToken()).length()==0)
            continue;

        this->EssiTagList.insert(str.currToken());
    }

    while(getline(mapFile,line)) {

        string Id, GmshCommandList, EssiCommand="";
        Tokenizer str = Tokenizer(line,"!  \t\v\n\r\f");

        if(!delSpaces(str.nextToken()).substr(0,2).compare("//"))
            continue;
        if(delSpaces(str.currToken()).length()==0)
            continue;

        Id = str.currToken();
        str.setDelimiter("<>");

        if(delSpaces(str.nextToken()).length()==0)
            GmshCommandList = delSpaces(str.nextToken());
        else
            GmshCommandList = delSpaces(str.currToken());

        str.setDelimiter("  \t\v\n\r\f");

        EssiCommand= EssiCommand + delSpaces(str.nextToken())+" ";
        str.setDelimiter("<>");
        EssiCommand= EssiCommand + str.nextToken();

        this->makeFunction(Id, GmshCommandList,EssiCommand);
    }

    mapFile.close();
}
开发者ID:jaabell,项目名称:gmESSI,代码行数:84,代码来源:Mapping.cpp

示例4: 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();
}
开发者ID:SumeetSinha,项目名称:gmESSI,代码行数:68,代码来源:Semantics.cpp


注:本文中的Tokenizer::currToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。