本文整理汇总了C++中FindCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ FindCommand函数的具体用法?C++ FindCommand怎么用?C++ FindCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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);
}
示例4: SendReject
void CPlayerWatcherBase::SendReject(TUid aInterfaceUid, TUint aTransactionId)
{
TRemConClientId clientId;
(void)FindCommand(aInterfaceUid, aTransactionId, clientId);
ReceiveReject(clientId);
}
示例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) ;
}
示例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;
}
示例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;
}
示例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 );
}
}
}
示例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)
//}
}
}
}
示例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);
}
示例11: RegisterCommand
void ICommand::RegisterCommand(std::string strName, ICommand* pCommand)
{
if(FindCommand(strName)==NULL)
{
gCommands[strName] = pCommand;
}
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}