本文整理汇总了C++中KeyMap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyMap::find方法的具体用法?C++ KeyMap::find怎么用?C++ KeyMap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyMap
的用法示例。
在下文中一共展示了KeyMap::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startConsole
void startConsole()
{
//intptr_t serverId = _spawnl(_P_NOWAIT, "TiGaServ.exe", "TiGaServ.exe", "15600" );
//intptr_t clientId = _spawnl(_P_NOWAIT, "TiGaClient.exe", "TiGaServ.exe", "localhost", "15600" );
bool exit = false;
KeyMap keyMap;
MENU_BEGIN('1',"Print menu")
printMenu(keyMap);
MENU_END();
MENU_BEGIN('2',"Start server")
system("start TiGaServ.exe 15600" );
//if( serverId == 0 )
// serverId = _spawnl(_P_NOWAITO, "TiGaServ.exe", "TiGaServ.exe", "15600" );
MENU_END();
MENU_BEGIN('3',"Start client")
system("start TiGaClient.exe 127.0.0.1 15600" );
//size_t id = spawnClient();
//printf("Client %d spawned\n",id);
MENU_END();
MENU_BEGIN(' ',"Exit")
exit = true;
MENU_END();
printMenu(keyMap);
while(exit != true)
{
int ch = getch();
KeyMap::iterator it = keyMap.find(ch);
if( it != keyMap.end() )
it->second.second();
}
}
示例2: make_key
static rinteger make_key(Env* env, Method* meth, KeyMap& keys) {
KeyMap::iterator iter = keys.find(meth);
if(iter == keys.end()) {
rinteger key = env->integer_new(keys.size());
keys[meth] = key;
return key;
}
return iter->second;
}