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


C++ CConsole类代码示例

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


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

示例1: ConToggleStroke

void CConsole::ConToggleStroke(IConsole::IResult *pResult, void *pUser)
{
	CConsole* pConsole = static_cast<CConsole *>(pUser);
	char aBuf[128] = {0};
	CCommand *pCommand = pConsole->FindCommand(pResult->GetString(1), pConsole->m_FlagMask);
	if(pCommand)
	{
		FCommandCallback pfnCallback = pCommand->m_pfnCallback;

		// check for chain
		if(pCommand->m_pfnCallback == Con_Chain)
		{
			CChain *pChainInfo = static_cast<CChain *>(pCommand->m_pUserData);
			pfnCallback = pChainInfo->m_pfnCallback;
		}

		if(pfnCallback == IntVariableCommand)
		{
			int Val = pResult->GetInteger(0)==0 ? pResult->GetInteger(3) : pResult->GetInteger(2);
			str_format(aBuf, sizeof(aBuf), "%s %i", pResult->GetString(1), Val);
			pConsole->ExecuteLine(aBuf);
			aBuf[0] = 0;
		}
		else
			str_format(aBuf, sizeof(aBuf), "Invalid command: '%s'.", pResult->GetString(1));
	}
	else
		str_format(aBuf, sizeof(aBuf), "No such command: '%s'.", pResult->GetString(1));

	if(aBuf[0] != 0)
		pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
开发者ID:Henningstone,项目名称:Ninslash,代码行数:32,代码来源:console.cpp

示例2: Execute

int CShellCommandChangeKey::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
	BOOL blnHelp = FALSE;

	rArguments.ResetArgumentIteration();
	const TCHAR *pchCommandItself = rArguments.GetNextArgument();
	const TCHAR *pchPath = rArguments.GetNextArgument();

	if ((_tcsnicmp(pchCommandItself,CD_CMD _T(".."),CD_CMD_LENGTH+2*sizeof(TCHAR)) == 0)||
		(_tcsnicmp(pchCommandItself,CD_CMD _T("\\"),CD_CMD_LENGTH+1*sizeof(TCHAR)) == 0))
	{
		if (!pchPath) pchPath = pchCommandItself + CD_CMD_LENGTH;
		else blnHelp = TRUE;
	}

	if ((!blnHelp)&&(pchPath != NULL)&&(!rArguments.GetNextArgument()))
	{
    size_t size = _tcslen(pchPath);
		ASSERT(size <= PROMPT_BUFFER_SIZE);

		if (!m_rTree.ChangeCurrentKey(pchPath))
		{
			rConsole.Write(m_rTree.GetLastErrorDescription());
			rConsole.Write(_T("\n"));
		}
	}
	else
	{
		rConsole.Write(GetHelpString());
	}

	return 0;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:33,代码来源:ShellCommandChangeKey.cpp

示例3: ConModCommandStatus

void CConsole::ConModCommandStatus(IResult *pResult, void *pUser)
{
	CConsole* pConsole = static_cast<CConsole *>(pUser);
	char aBuf[240];
	mem_zero(aBuf, sizeof(aBuf));
	int Used = 0;

	for(CCommand *pCommand = pConsole->m_pFirstCommand; pCommand; pCommand = pCommand->m_pNext)
	{
		if(pCommand->m_Flags&pConsole->m_FlagMask && pCommand->GetAccessLevel() == ACCESS_LEVEL_MOD)
		{
			int Length = str_length(pCommand->m_pName);
			if(Used + Length + 2 < (int)(sizeof(aBuf)))
			{
				if(Used > 0)
				{
					Used += 2;
					str_append(aBuf, ", ", sizeof(aBuf));
				}
				str_append(aBuf, pCommand->m_pName, sizeof(aBuf));
				Used += Length;
			}
			else
			{
				pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
				mem_zero(aBuf, sizeof(aBuf));
				str_copy(aBuf, pCommand->m_pName, sizeof(aBuf));
				Used = Length;
			}
		}
	}
	if(Used > 0)
		pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
开发者ID:Henningstone,项目名称:Ninslash,代码行数:34,代码来源:console.cpp

示例4: Get

void CApplication::CloseConsole()
{
	if (!Get())
		return;

	CConsole* pConsole = Get()->GetConsole();
	pConsole->SetVisible(false);
}
开发者ID:BSVino,项目名称:LunarWorkshop,代码行数:8,代码来源:console.cpp

示例5: ApplyConsoleSettings

void CCore::ApplyConsoleSettings ( void )
{
    CVector2D vec;
    CConsole * pConsole = m_pLocalGUI->GetConsole ();

    CVARS_GET ( "console_pos", vec );
    pConsole->SetPosition ( vec );
    CVARS_GET ( "console_size", vec );
    pConsole->SetSize ( vec );
}
开发者ID:AdiBoy,项目名称:multitheftauto,代码行数:10,代码来源:CCore.cpp

示例6: ConModCommandAccess

void CConsole::ConModCommandAccess(IResult *pResult, void *pUser)
{
	CConsole* pConsole = static_cast<CConsole *>(pUser);
	char aBuf[128];
	CCommand *pCommand = pConsole->FindCommand(pResult->GetString(0), CFGFLAG_SERVER);
	if(pCommand)
	{
		if(pResult->NumArguments() == 2)
		{
			pCommand->SetAccessLevel(pResult->GetInteger(1) == 0 ? ACCESS_LEVEL_USER : pResult->GetInteger(1) == 1 ? ACCESS_LEVEL_HELPER : pResult->GetInteger(1) == 2 ? ACCESS_LEVEL_MOD : pResult->GetInteger(1) == 3 ? ACCESS_LEVEL_SUBADMIN : ACCESS_LEVEL_ADMIN);

			str_format(aBuf, sizeof(aBuf), "subadmin access for '%s' is now %s", pResult->GetString(0), pCommand->GetAccessLevel() ? "enabled" : "disabled");
			pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
			str_format(aBuf, sizeof(aBuf), "moderator access for '%s' is now %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_MOD ? "enabled" : "disabled");
			pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
			str_format(aBuf, sizeof(aBuf), "helper access for '%s' is now %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_HELPER ? "enabled" : "disabled");
			pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
			str_format(aBuf, sizeof(aBuf), "user access for '%s' is now %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_USER ? "enabled" : "disabled");
		}
		else
		{
			str_format(aBuf, sizeof(aBuf), "subadmin access for '%s' is %s", pResult->GetString(0), pCommand->GetAccessLevel() ? "enabled" : "disabled");
			pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
			str_format(aBuf, sizeof(aBuf), "moderator access for '%s' is %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_MOD ? "enabled" : "disabled");
			pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
			str_format(aBuf, sizeof(aBuf), "helper access for '%s' is %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_HELPER ? "enabled" : "disabled");
			pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
			str_format(aBuf, sizeof(aBuf), "user access for '%s' is %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_USER ? "enabled" : "disabled");
		}
	}
	else
		str_format(aBuf, sizeof(aBuf), "No such command: '%s'.", pResult->GetString(0));

	pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
开发者ID:ftk,项目名称:XXLDDRace,代码行数:35,代码来源:console.cpp

示例7: ConUserCommandStatus

void CConsole::ConUserCommandStatus(IResult *pResult, void *pUser)
{
	CConsole* pConsole = static_cast<CConsole *>(pUser);
	CResult Result;
	Result.m_pCommand = "access_status";
	char aBuf[4];
	str_format(aBuf, sizeof(aBuf), "%d", IConsole::ACCESS_LEVEL_USER);
	Result.AddArgument(aBuf);

	pConsole->ConCommandStatus(&Result, pConsole);
}
开发者ID:Ryozuki,项目名称:ddnet,代码行数:11,代码来源:console.cpp

示例8: cleanup

void UIConsoleEventHandler::cleanup()
{
    /* Get console: */
    const CConsole console = m_pSession->session().GetConsole();
    if (console.isNull() || !console.isOk())
        return;
    /* Get event-source: */
    CEventSource eventSource = console.GetEventSource();
    AssertReturnVoid(!eventSource.isNull() || eventSource.isOk());
    /* Unregister listener: */
    eventSource.UnregisterListener(m_mainEventListener);
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:12,代码来源:UIConsoleEventHandler.cpp

示例9: AssertReturn

void VBoxSnapshotsWgt::sltRestoreSnapshot(bool fSuppressNonCriticalWarnings /* = false*/)
{
    /* Get currently chosen item: */
    SnapshotWgtItem *pItem = mTreeWidget->currentItem() ? static_cast<SnapshotWgtItem*>(mTreeWidget->currentItem()) : 0;
    AssertReturn(pItem, (void)0);
    /* Detemine snapshot id: */
    QString strSnapshotId = pItem->snapshotId();
    AssertReturn(!strSnapshotId.isNull(), (void)0);
    /* Get currently desired snapshot: */
    CSnapshot snapshot = mMachine.FindSnapshot(strSnapshotId);

    /* Ask the user if he really wants to restore the snapshot: */
    int iResultCode = AlertButton_Ok;
    if (!fSuppressNonCriticalWarnings || mMachine.GetCurrentStateModified())
    {
        iResultCode = msgCenter().confirmSnapshotRestoring(snapshot.GetName(), mMachine.GetCurrentStateModified());
        if (iResultCode & AlertButton_Cancel)
            return;
    }

    /* If user also confirmed new snapshot creation: */
    if (iResultCode & AlertOption_CheckBox)
    {
        /* Take snapshot of changed current state: */
        mTreeWidget->setCurrentItem(curStateItem());
        if (!takeSnapshot())
            return;
    }

    /* Open a direct session (this call will handle all errors): */
    CSession session = vboxGlobal().openSession(mMachineId);
    if (session.isNull())
        return;

    /* Restore chosen snapshot: */
    CConsole console = session.GetConsole();
    CProgress progress = console.RestoreSnapshot(snapshot);
    if (console.isOk())
    {
        msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_restore_90px.png");
        if (progress.GetResultCode() != 0)
            msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), mMachine.GetName());
    }
    else
        msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), mMachine.GetName());

    /* Unlock machine finally: */
    session.UnlockMachine();
}
开发者ID:bayasist,项目名称:vbox,代码行数:49,代码来源:VBoxSnapshotsWgt.cpp

示例10: ConModCommandAccess

void CConsole::ConModCommandAccess(IResult *pResult, void *pUser)
{
    CConsole* pConsole = static_cast<CConsole *>(pUser);
    char aBuf[128];
    CCommand *pCommand = pConsole->FindCommand(pResult->GetString(0), CFGFLAG_SERVER);
    if(pCommand)
    {
        if(pResult->NumArguments() == 2)
        {
            pCommand->m_AccessLevel = clamp(pResult->GetInteger(1), (int)(ACCESS_LEVEL_ADMIN), (int)(ACCESS_LEVEL_MOD));
            str_format(aBuf, sizeof(aBuf), "moderator access for '%s' is now %s", pResult->GetString(0), pCommand->m_AccessLevel ? "enabled" : "disabled");
        }
        else
            str_format(aBuf, sizeof(aBuf), "moderator access for '%s' is %s", pResult->GetString(0), pCommand->m_AccessLevel ? "enabled" : "disabled");
    }
    else
        str_format(aBuf, sizeof(aBuf), "No such command: '%s'.", pResult->GetString(0));

    pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
}
开发者ID:RyomouHentaiGirl,项目名称:teeworlds,代码行数:20,代码来源:console.cpp

示例11: ShowPrompt

void CPrompt::ShowPrompt(CConsole &rConsole)
{
  TCHAR *pch = m_pszPrompt;
  TCHAR Buffer[2] = " ";

  const TCHAR *pszCurrentPath;

  while (*pch)
  {
    if (_tcsncmp(pch,CURRENT_PATH_ALIAS,_tcslen(CURRENT_PATH_ALIAS)) == 0)
    {
      pszCurrentPath = m_rTree.GetCurrentPath();
      rConsole.Write(pszCurrentPath?pszCurrentPath:_T("NULL (Internal Error)"));
      pch += _tcslen(CURRENT_PATH_ALIAS);
    }
    else
    {
      Buffer[0] = *pch++;
      rConsole.Write(Buffer);
    }
  }
}
开发者ID:hoangduit,项目名称:reactos,代码行数:22,代码来源:Prompt.cpp

示例12: ConToggle

bool CConsole::ConToggle(IConsole::IResult *pResult, void *pUser)
{
	CConsole* pConsole = static_cast<CConsole *>(pUser);
	char aBuf[128] = {0};
	CCommand *pCommand = pConsole->FindCommand(pResult->GetString(0), pConsole->m_FlagMask);
	if(pCommand)
	{
		FCommandCallback pfnCallback = pCommand->m_pfnCallback;
		void *pUserData = pCommand->m_pUserData;

		// check for chain
		if(pCommand->m_pfnCallback == Con_Chain)
		{
			CChain *pChainInfo = static_cast<CChain *>(pCommand->m_pUserData);
			pfnCallback = pChainInfo->m_pfnCallback;
			pUserData = pChainInfo->m_pCallbackUserData;
		}

		if(pfnCallback == IntVariableCommand)
		{
			CIntVariableData *pData = static_cast<CIntVariableData *>(pUserData);
			int Val = *(pData->m_pVariable)==pResult->GetInteger(1) ? pResult->GetInteger(2) : pResult->GetInteger(1);
			str_format(aBuf, sizeof(aBuf), "%s %i", pResult->GetString(0), Val);
			pConsole->ExecuteLine(aBuf, -1, false);
			aBuf[0] = 0;
		}
		else
			str_format(aBuf, sizeof(aBuf), "Invalid command: '%s'.", pResult->GetString(0));
	}
	else
		str_format(aBuf, sizeof(aBuf), "No such command: '%s'.", pResult->GetString(0));

	if(aBuf[0] != 0)
		pConsole->Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
	
	return true;
}
开发者ID:necropotame,项目名称:teeworlds-infclass,代码行数:37,代码来源:console.cpp

示例13: Execute

int CShellCommandConnect::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
	const TCHAR *pchArg;
	const TCHAR *pchMachine = NULL;
	BOOL blnHelp = FALSE;

	VERIFY(m_rTree.ChangeCurrentKey(_T("\\")));

	while ((pchArg = rArguments.GetNextArgument()) != NULL)
	{
		if ((_tcsicmp(pchArg,_T("/?")) == 0)
			||(_tcsicmp(pchArg,_T("-?")) == 0))
		{
			blnHelp = TRUE;
		}
//		else if ((_tcsicmp(pchArg,_T("-a")) == 0)||
//			(_tcsicmp(pchArg,_T("/a")) == 0))
//		{
//		}
		else
		{
			pchMachine = pchArg;
		}
	}

	if (blnHelp)
		rConsole.Write(GetHelpString());

	if (!m_rTree.SetMachineName(pchMachine))
  {
    rConsole.Write(m_rTree.GetLastErrorDescription());
    rConsole.Write(_T("\n"));
  }

	return 0;
}
开发者ID:GYGit,项目名称:reactos,代码行数:36,代码来源:ShellCommandConnect.cpp

示例14: Execute

int CShellCommandDeleteValue::Execute(CConsole &rConsole, CArgumentParser& rArguments)
{
  rArguments.ResetArgumentIteration();
  TCHAR *pszCommandItself = rArguments.GetNextArgument();

  TCHAR *pszParameter;
  TCHAR *pszValueFull = NULL;
  BOOL blnHelp = FALSE;

  if ((_tcsnicmp(pszCommandItself,DV_CMD _T(".."),DV_CMD_LENGTH+2*sizeof(TCHAR)) == 0)||
      (_tcsnicmp(pszCommandItself,DV_CMD _T("\\"),DV_CMD_LENGTH+1*sizeof(TCHAR)) == 0))
  {
    pszValueFull = pszCommandItself + DV_CMD_LENGTH;
  }
  else if (_tcsnicmp(pszCommandItself,DV_CMD _T("/"),DV_CMD_LENGTH+1*sizeof(TCHAR)) == 0)
  {
    pszParameter = pszCommandItself + DV_CMD_LENGTH;
    goto CheckValueArgument;
  }

  while((pszParameter = rArguments.GetNextArgument()) != NULL)
  {
CheckValueArgument:
    if ((_tcsicmp(pszParameter,_T("/?")) == 0)
        ||(_tcsicmp(pszParameter,_T("-?")) == 0))
    {
      blnHelp = TRUE;
      break;
    }
    else if (!pszValueFull)
    {
      pszValueFull = pszParameter;
    }
    else
    {
      rConsole.Write(_T("Bad parameter: "));
      rConsole.Write(pszParameter);
      rConsole.Write(_T("\n"));
    }
  }

  CRegistryKey Key;
  TCHAR *pszValueNamePattern;
  const TCHAR *pszEmpty = _T("");
  const TCHAR *pszPath;

  if (blnHelp)
  {
    rConsole.Write(GetHelpString());
    return 0;
  }

  if (pszValueFull)
  {
    if (_tcscmp(pszValueFull,_T("\\")) == 0)
      goto CommandNAonRoot;

    TCHAR *pchSep = _tcsrchr(pszValueFull,_T('\\'));
    pszValueNamePattern = pchSep?(pchSep+1):(pszValueFull);
    pszPath = pchSep?pszValueFull:_T(".");

    if (pchSep)
      *pchSep = 0;
  }
  else
  {
    pszValueNamePattern = (TCHAR*)pszEmpty;
    pszPath = _T(".");
  }

  {
    size_t s = _tcslen(pszValueNamePattern);
    if (s && (pszValueNamePattern[0] == _T('\"'))&&(pszValueNamePattern[s-1] == _T('\"')))
    {
      pszValueNamePattern[s-1] = 0;
      pszValueNamePattern++;
    }
  }

  if (!m_rTree.GetKey(pszPath,KEY_QUERY_VALUE|KEY_SET_VALUE,Key))
  {
    rConsole.Write(m_rTree.GetLastErrorDescription());
    return 0;
  }

  if (!Key.IsRoot())
  {	// not root key ???
    TCHAR Buffer[254];
    DWORD dwMaxValueNameLength;
    LONG nError = Key.GetMaxValueNameLength(dwMaxValueNameLength);
    if (nError != ERROR_SUCCESS)
    {
      _stprintf(Buffer,_T("Cannot query info about %s key. Error is %u\n"),Key.GetKeyName(),(unsigned int)nError);
      rConsole.Write(Buffer);
      return 0;
    }

    TCHAR *pszValueName = new (std::nothrow) TCHAR[dwMaxValueNameLength];
    if (!pszValueName)
    {
//.........这里部分代码省略.........
开发者ID:GYGit,项目名称:reactos,代码行数:101,代码来源:ShellCommandDeleteValue.cpp

示例15: CP_printfCreate

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int __cdecl CP_printfCreate( char * szTitle ){
  x_CmdWnd.Create(szTitle, TRUE);
  x_CmdWnd.Color( x_awDebugColors[LEVEL_NORMAL] );
  x_CmdWnd.Clear();

  return 0;
}
开发者ID:,项目名称:,代码行数:8,代码来源:


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