本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}