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


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

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


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

示例1: client_snapshot

bool client_snapshot(int from_gid, int from_tid, int to, int sid, const char *msg)
{
	if (message_filter != -1 && message_filter != to)
		return true;
	
	Tokenizer t;
	t.parse(msg);
	
	const char *ssnaptype = "Unknown snaptype";
	switch (sid)
	{
		case SnapGameState:	ssnaptype = "SnapGameState";	break;
		case SnapTable:		ssnaptype = "SnapTable";	break;
		case SnapCards:		ssnaptype = "SnapCards";	break;
		case SnapWinPot:	ssnaptype = "SnapWinPot";	break;
		case SnapOddChips:	ssnaptype = "SnapOddChips";	break;
		case SnapPlayerAction:	ssnaptype = "SnapPlayerAction";	break;
		case SnapPlayerShow:	ssnaptype = "SnapPlayerShow";	break;
		
	}
	
	
	if (sid == SnapWinPot)
	{
		int cid, pot, amount;
		t >> cid >> pot >> amount;
		log_msg(ssnaptype, "cid=%d pot=%d amount=%d",
			 cid, pot, amount);
	}
开发者ID:holdingnuts,项目名称:holdingnuts,代码行数:29,代码来源:gc_test.cpp

示例2: MatchDocument

ErrorCode TbbProcessor::MatchDocument(DocID doc_id, const char* doc_str)
{
    uint64_t len=strlen(doc_str);
    std::shared_ptr<char> str(reinterpret_cast<char*>(operator new(len+1)));
    memcpy(str.get(),doc_str,len+1);

    matchingTg.run([&,str,len,doc_id,this]() {
        Tokenizer tokenizer;
        tokenizer.parse(str.get(),len);

        std::vector<uint32_t> edQueries,hammingIds,exactQueries;

        tbb::task_group tg;
        tg.run([&,this](){ exactQueries=indexes.exactIndex.matchDocument(tokenizer); });
        tg.run([&,this](){ hammingIds=indexes.hammingIndex.matchDocument(tokenizer); });
        tg.run([&,this](){ edQueries=indexes.edIndex.matchDocument(tokenizer); });
        tg.wait();

        std::vector<QueryID> query_ids; query_ids.reserve(exactQueries.size()+hammingIds.size()+edQueries.size());
        query_ids.insert(query_ids.end(),edQueries.begin(),edQueries.end());
        query_ids.insert(query_ids.end(),hammingIds.begin(),hammingIds.end());
        query_ids.insert(query_ids.end(),exactQueries.begin(),exactQueries.end());

        docs.push(Document(doc_id,query_ids));
    });

	return EC_SUCCESS;
}
开发者ID:henrik-muehe,项目名称:sigmod2013,代码行数:28,代码来源:tbb_processor.cpp

示例3:

TEST_F(MatcherTests,MassiveAdd) {
	EditDistance a;
	for (uint64_t index=0;index<1000000;++index)
		a.addQuery(index,random()%3,randomWordVector());

	std::string s=randomString(1000000);
	Tokenizer t;
	t.parse(s.c_str(),s.length());

	a.matchDocument(t);
}
开发者ID:henrik-muehe,项目名称:sigmod2013,代码行数:11,代码来源:matchertests.cpp

示例4: main

int main(void){
	Tokenizer* token = new Tokenizer();
	Result* r = token->parse("1 + 2 + 3");
	// 6 * 2 -> 12 -> 19
	//r->calc();
	//cout << ((3 * 2) * 2 + (1 + 6)) * 15 / (2 + 1) << endl;
	//cout << r->debug() << endl;
	//cout << r->calc() << endl;
	system("pause");
	return 0;
}
开发者ID:guisoares2011,项目名称:math-compliler,代码行数:11,代码来源:Main.cpp

示例5: load

bool ConfigParser::load(const char *filename)
{
	filetype *fp;
	
	fp = file_open(filename, mode_read);
	
	if (!fp)
		return false;
	
	char buffer[1024];
	
	// parse each line in config-file
	while (file_readline(fp, buffer, sizeof(buffer)))
	{
		Tokenizer t;
		t.parse(buffer);
		
		// skip blank lines
		if (!t.count())
			continue;
		
		string varname = t.getNext();
		
		// skip comments
		if (varname[0] == '#')
			continue;
		
		string value = t.getTillEnd();
		
		vars[varname] = value;
	}
	
	file_close(fp);
	
	return true;
}
开发者ID:gkaptch1,项目名称:SplitPoker_pubilc,代码行数:36,代码来源:ConfigParser.cpp


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