• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindCommand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FindCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ FindCommand函数的具体用法?C++ FindCommand怎么用?C++ FindCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: FindCommand

CLIHANDLER *CCLITerminal::FindCommandHandler(CLISESSION *pSession, int &nDepts, char *pszNode)
{
	CLIHANDLER	*pHandler;

	if (m_pCLIService->GetRunLevel() == RUNLEVEL_DEBUG)
		 pHandler = FindCommand(pSession, m_CliDebugCommandHandlers, nDepts, pszNode);
	else pHandler = FindCommand(pSession, m_pCommandHandlers, nDepts, pszNode);
	return pHandler;
}
开发者ID:bearxiong99,项目名称:new_swamm,代码行数:9,代码来源:CLITerminal.cpp


示例2: AddCommand

	Command* CommandMap::AddCommand(Command command)
	{
		if (FindCommand(command.Name) || FindCommand(command.ShortName))
			return nullptr;

		this->Commands.push_back(command);

		return &this->Commands.back();
	}
开发者ID:no1dead,项目名称:ElDorito,代码行数:9,代码来源:CommandMap.cpp


示例3: FindCommand

void CConsole::Register(const char *pName, const char *pParams,
	int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp)
{
	CCommand *pCommand = FindCommand(pName, Flags);
	bool DoAdd = false;
	if(pCommand == 0)
	{
		pCommand = new(mem_alloc(sizeof(CCommand), sizeof(void*))) CCommand;
		DoAdd = true;
	}
	pCommand->m_pfnCallback = pfnFunc;
	pCommand->m_pUserData = pUser;

	pCommand->m_pName = pName;
	GenerateUsage(pParams, pCommand->m_pUsage);
	pCommand->m_pHelp = pHelp;
	pCommand->m_pParams = pParams;

	pCommand->m_Flags = Flags;
	pCommand->m_Temp = false;

	if(pCommand->m_Flags&CFGFLAG_USER)
		pCommand->SetAccessLevel(ACCESS_LEVEL_USER);
		
	if(DoAdd)
		AddCommandSorted(pCommand);
}
开发者ID:necropotame,项目名称:teeworlds-infclass,代码行数:27,代码来源:console.cpp


示例4: SendReject

void CPlayerWatcherBase::SendReject(TUid aInterfaceUid, TUint aTransactionId)
	{
	TRemConClientId clientId;
	(void)FindCommand(aInterfaceUid, aTransactionId, clientId);

	ReceiveReject(clientId);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:7,代码来源:playerstatewatcher.cpp


示例5: CompileCommand

T_void CompileCommand(T_byte8 *p_line)
{
    T_byte8 command[80] ;
    T_byte8 command2[80] ;
    T_byte8 *p_open ;
    T_sword16 commandNum ;

    sscanf(p_line, "%s", command) ;

    p_open = strstr(command, "(") ;
    if (p_open)
        *p_open = '\0' ;
    command2[0] = '\0' ;
    sscanf(command, "%s", command2) ;
    if (!command2[0])
         return ;
    commandNum = FindCommand(command2) ;
    if (commandNum == -1)  {
        printf("Error!  Unknown command '%s' on line %d\n", command2, G_line) ;
        exit(201) ;
    }
//    printf("command: <%s> = %d\n", command2, commandNum) ;
    OutputByte((T_byte8)commandNum) ;

    p_open = strstr(p_line, "(") ;
    if (!p_open)  {
        printf("Error!  Missing '(' on line %d\n", G_line) ;
        exit(202);
    }

    CompileArgs(p_open, G_commands[commandNum].numArgs) ;
}
开发者ID:ExiguusEntertainment,项目名称:AAScriptCompiler,代码行数:32,代码来源:SC.C


示例6: mgl_trim_ws

//-----------------------------------------------------------------------------
// return values: 0 - OK, 1 - wrong arguments, 2 - wrong command, 3 - string too long, 4 -- unclosed string
int mglParser::ParseDat(mglGraph *gr, std::wstring str, mglData &res)
{
	std::wstring arg[32];
	str = mgl_trim_ws(str);
	long n,k=0;
	for(k=0;k<32;k++)	// parse string to substrings (by spaces)
	{
		n = mglFindArg(str);
		if(n<1)	{	if(n<0)	str=str.substr(0,-n);	break;	}
		arg[k] = str.substr(0,n);//	k++;
		str = str.substr(n+1);	str = mgl_trim_ws(str);
	}
	// try to find last argument
	if(!str.empty())	{	arg[k] = str;	k++;	}
	if(k<1) n = 0;
	else
	{	// fill arguments by its values
		mglArg *a = new mglArg[k+1];
		FillArg(gr, k, arg, a+1);	a[0].type=0;	a[0].d=&res;
		// alocate new arrays and execute the command itself
		int i;
		std::string kk;
		const char *id="dsn";
		for(i=0;i<k;i++)
		{
			kk += id[a[i].type];
			a[i].s.assign(a[i].w.begin(),a[i].w.end());
		}
		const mglCommand *rts=FindCommand(arg[0].c_str());
		if(!rts || rts->type!=4)	n = 2;
		else n = rts->exec(gr, k, a, kk.c_str(), 0);
		delete []a;
	}
	return n;
}
开发者ID:nickjhathaway,项目名称:mathgl,代码行数:37,代码来源:parser.cpp


示例7: wcstombs

//-----------------------------------------------------------------------------
// return values : 0 -- OK, 1 -- wrong arguments, 2 -- wrong command, 3 -- unclosed string
int mglParser::Exec(mglGraph *gr, const wchar_t *com, long n, mglArg *a, const std::wstring &var, const wchar_t *opt)
{
	int i;
	const char *id="dsn";
	std::string k;
	for(i=0;i<n;i++)
	{
		k += id[a[i].type];
		size_t len = wcstombs(NULL,a[i].w.c_str(),0)+1;
		char *buf = new char[len];	memset(buf,0,len);
		wcstombs(buf,a[i].w.c_str(),len);
		a[i].s = buf;	delete []buf;
	}
	const mglCommand *rts=FindCommand(com);
	if(!rts || rts->type==6)	return 2;
/*	if(rts->type == 4)
	{
		if(n<1 || CheckForName(var))	return 2;
		a[0].type = 0;	a[0].d = AddVar(var.c_str());
		a[0].w = var;	k[0] = 'd';
	}*/
	char *o=0;
	if(opt && *opt)	// TODO: parse arguments of options
	{
		long len = mgl_wcslen(opt);
		o = new char[len+1];
		for(i=0;i<len+1;i++)	o[i]=opt[i];
	}
	int res=rts->exec(gr, n, a, k.c_str(), o);
	if(o)	delete []o;
	return res;
}
开发者ID:nickjhathaway,项目名称:mathgl,代码行数:34,代码来源:parser.cpp


示例8: PrintHelp

void PrintHelp( const Seperator& cmd )
{
    const char* cmdName = cmd.arg( 0 ).c_str();

    if( 1 == cmd.argCount() )
    {
        sLog.Log( cmdName, "Available commands:" );

        for( size_t i = 0; i < EVETOOL_COMMAND_COUNT; ++i )
        {
            const EVEToolCommand* c = &EVETOOL_COMMANDS[i];

            sLog.Log( cmdName, "%s", c->name );
        }

        sLog.Log( cmdName, "You can get detailed help by typing '%s <command> [<command>] ...'.", cmdName );
    }
    else
    {
        for( size_t i = 1; i < cmd.argCount(); ++i )
        {
            const std::string& cmdStr = cmd.arg( i );
            const EVEToolCommand* c = FindCommand( cmdStr );

            if( NULL == c )
                sLog.Error( cmdName, "Unknown command '%s'.", cmdStr.c_str() );
            else
                sLog.Log( cmdName, "%s: %s", c->name, c->description );
        }
    }
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:31,代码来源:Commands.cpp


示例9: UpdateMenuKeys

// use custom accelerator table to change the keyboard shortcuts displayed on said hMenu
void UpdateMenuKeys(HMENU hMenu) 
{
	ATLASSERT(hMenu);

	int nItems = ::GetMenuItemCount(hMenu);
	CMenuItemInfo mi;
	mi.fMask = MIIM_ID | MIIM_SUBMENU;
	TCHAR buf[512];
	CString name;
	for(int i = 0; i < nItems; i++)
	{
		// i hope we're not going to have GPFs like in RepairMenu!
		::GetMenuItemInfo(hMenu, i, TRUE, &mi); // by position
		if(mi.hSubMenu)
			UpdateMenuKeys(mi.hSubMenu);
		else if(mi.wID != 0 ) { // separators etc excluded
			// see if there's accelerator info in text
			ATLASSERT(!(buf[0] = 0));
			::GetMenuString(hMenu, i, buf, sizeof(buf)/sizeof(buf[0]), MF_BYPOSITION);
			ATLASSERT(buf[0]);

			int len = lstrlen(buf), k = len;
			/*while(k--)
				if(_T('\t') == buf[k])
					break;
			BOOL bTab = k > 0;
			BOOL bChanged = 1;*/

			// is there any accelerator for this command nowadays?
			CString MenuString = FindCommand(mi.wID);
			MenuString = _T('\t')+MenuString;
			MenuString = buf+MenuString;
			//if(-1 == idx) {
			//	if(bTab)
			//		buf[k] = 0; // remove old one
			//	else
			//		bChanged = 0;
			//}
			//else {
			//	if(!bTab) {
			//		k = len;
			//		buf[k] = _T('\t');
			//	}
			//	k++;

			//	name = dummy.NameFromAccel(m_pAccelTable[idx]);
			//	ATLASSERT(k+name.GetLength() < sizeof(buf)/sizeof(buf[0]));
			//	lstrcpy(buf+k, name);
			//}

			//if(bChanged) {
			//	ATLASSERT(lstrlen(buf));
			::ModifyMenu(hMenu, i, MF_BYPOSITION, mi.wID, MenuString.GetBuffer(512));
			MenuString.ReleaseBuffer();
				// $TSEK no need to update item enable/icon states? (see wtl's command bar atlctrlw.h line 2630)
			//}
		}
	}
}
开发者ID:boogunote,项目名称:bn1,代码行数:60,代码来源:Common.cpp


示例10: FindCommand

	VariableSetReturnValue CommandMap::SetVariable(const std::string& name, std::string& value, std::string& previousValue)
	{
		auto command = FindCommand(name);
		if (!command)
			return eVariableSetReturnValueError;

		return SetVariable(command, value, previousValue);
	}
开发者ID:no1dead,项目名称:ElDorito,代码行数:8,代码来源:CommandMap.cpp


示例11: RegisterCommand

	void ICommand::RegisterCommand(std::string strName, ICommand* pCommand)
	{
		if(FindCommand(strName)==NULL)
		{
           gCommands[strName] = pCommand;
		}
		
	}
开发者ID:lozpeng,项目名称:applesales,代码行数:8,代码来源:ICommand.cpp


示例12: main

main()
{
    initilize();

    while(1)
    {
        int id;

		// Read line from user, and get the function id from it
        GetLine();
        id = FindCommand();

        switch(id)
        {
            case 0:
                mkdir(pathname);
                break;
            case 1:
                rmdir(pathname);
                break;
            case 2:
                cd(pathname);
                break;
            case 3:
                ls();
                break;
            case 4:
                pwd();
                break;
            case 5:
                creat(pathname);
                break;
            case 6:
                rm(pathname);
                break;
            case 7:
                save();
                break;
            case 8:
                reload();
                break;
            case 9:
                menu();
                break;
            case 10:
                quit();
                break;
            default:
                printf("Command not recognized! Please try again.\n\n");
                break;
        }
    }




	return 0;
}
开发者ID:russvick,项目名称:CS360,代码行数:58,代码来源:main.c


示例13: ProcessCommand

void ProcessCommand( const Seperator& cmd )
{
    const char* cmdName = cmd.arg( 0 ).c_str();
    const EVEToolCommand* c = FindCommand( cmdName );

    if( NULL == c )
        sLog.Error( "input", "Unknown command '%s'.", cmdName );
    else
        ( *c->callback )( cmd );
}
开发者ID:AlTahir,项目名称:Apocrypha_combo,代码行数:10,代码来源:Commands.cpp


示例14: FindCommand

TInt CPlayerWatcherBase::SendRemConResponse(TUid aInterfaceUid, TUint aTransactionId, RBuf8& aData)
	{
	LOG_FUNC;

	TRemConClientId clientId;
	CInternalCommand& command = FindCommand(aInterfaceUid, aTransactionId, clientId);

	ReceiveUpdate(command, clientId, aData);

	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:11,代码来源:playerstatewatcher.cpp


示例15: AddCommand

bool CModule::AddCommand(const CModCommand& Command)
{
    if (Command.GetFunction() == NULL)
        return false;
    if (Command.GetCommand().find(' ') != CString::npos)
        return false;
    if (FindCommand(Command.GetCommand()) != NULL)
        return false;

    m_mCommands[Command.GetCommand()] = Command;
    return true;
}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:12,代码来源:Modules.cpp


示例16: FindCommand

bool CModule::HandleCommand(const CString& sLine) {
    const CString& sCmd = sLine.Token(0);
    const CModCommand* pCmd = FindCommand(sCmd);

    if (pCmd) {
        pCmd->Call(this, sLine);
        return true;
    }

    OnUnknownModCommand(sLine);

    return false;
}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:13,代码来源:Modules.cpp


示例17: FindCommand

void ChatTriggers::OnSourceModGameInitialized()
{
	m_pSayCmd = FindCommand("say");
	m_pSayTeamCmd = FindCommand("say_team");

	if (m_pSayCmd)
	{
		SH_ADD_HOOK(ConCommand, Dispatch, m_pSayCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
		SH_ADD_HOOK(ConCommand, Dispatch, m_pSayCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
	}
	if (m_pSayTeamCmd)
	{
		SH_ADD_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
		SH_ADD_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
	}

#if SOURCE_ENGINE == SE_EPISODEONE
	m_bIsINS = (strcmp(g_SourceMod.GetGameFolderName(), "insurgency") == 0);

	if (m_bIsINS)
	{
		m_pSay2Cmd = FindCommand("say2");
		if (m_pSay2Cmd)
		{
			SH_ADD_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
			SH_ADD_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
		}
	}
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
	m_pSaySquadCmd = FindCommand("say_squad");

	if (m_pSaySquadCmd)
	{
		SH_ADD_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
		SH_ADD_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
	}
#endif
}
开发者ID:50Wliu,项目名称:sourcemod,代码行数:38,代码来源:ChatTriggers.cpp


示例18: OnExecuteCommand

LRESULT OnExecuteCommand( HWND hWnd, WPARAM wParam, LPARAM lParam, LPCLASSDATA lpcd )
{
	LPFUNC		lpfnFunction;

	/*
	 *	Find the command.
	 */
	if (( lpfnFunction = FindCommand( wParam )) != NULL )
		/*
		 *	Execute it.
		 */
		 ( lpfnFunction )( lpcd );
	return 0;
}
开发者ID:x2on,项目名称:NiLogViewer,代码行数:14,代码来源:commands.c


示例19: SH_ADD_HOOK

void NextMapManager::OnSourceModAllInitialized_Post()
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
	SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#else
	SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#endif

	ConCommand *pCmd = FindCommand("changelevel");
	if (pCmd != NULL)
	{
		SH_ADD_HOOK(ConCommand, Dispatch, pCmd, SH_STATIC(CmdChangeLevelCallback), false);
		changeLevelCmd = pCmd;
	}
}
开发者ID:DJLaca,项目名称:sourcemod,代码行数:15,代码来源:NextMap.cpp


示例20: while

bool CConsole::LineIsValid(const char *pStr)
{
	if(!pStr || *pStr == 0)
		return false;

	do
	{
		CResult Result;
		const char *pEnd = pStr;
		const char *pNextPart = 0;
		int InString = 0;

		while(*pEnd)
		{
			if(*pEnd == '"')
				InString ^= 1;
			else if(*pEnd == '\\') // escape sequences
			{
				if(pEnd[1] == '"')
					pEnd++;
			}
			else if(!InString)
			{
				if(*pEnd == ';') // command separator
				{
					pNextPart = pEnd+1;
					break;
				}
				else if(*pEnd == '#') // comment, no need to do anything more
					break;
			}

			pEnd++;
		}

		if(ParseStart(&Result, pStr, (pEnd-pStr) + 1) != 0)
			return false;

		CCommand *pCommand = FindCommand(Result.m_pCommand, m_FlagMask);
		if(!pCommand || ParseArgs(&Result, pCommand->m_pParams))
			return false;

		pStr = pNextPart;
	}
	while(pStr && *pStr);

	return true;
}
开发者ID:Henningstone,项目名称:Ninslash,代码行数:48,代码来源:console.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindControl函数代码示例发布时间:2022-05-30
下一篇:
C++ FindClose函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap