本文整理汇总了C++中IConfig类的典型用法代码示例。如果您正苦于以下问题:C++ IConfig类的具体用法?C++ IConfig怎么用?C++ IConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IConfig类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CALLSTACK_ADD
void CFriends::Init(bool Foes)
{
CALLSTACK_ADD();
m_Foes = Foes;
IConfig *pConfig = Kernel()->RequestInterface<IConfig>();
if(pConfig)
pConfig->RegisterCallback(ConfigSaveCallback, this);
IConsole *pConsole = Kernel()->RequestInterface<IConsole>();
if(pConsole)
{
if(Foes)
{
pConsole->Register("add_foe", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConAddFriend, this, "Add a foe");
pConsole->Register("remove_foe", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConRemoveFriend, this, "Remove a foe");
pConsole->Register("foes", "", CFGFLAG_CLIENT, ConFriends, this, "List foes");
}
else
{
pConsole->Register("add_friend", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConAddFriend, this, "Add a friend");
pConsole->Register("remove_friend", "s[name] ?s[clan]", CFGFLAG_CLIENT, ConRemoveFriend, this, "Remove a friend");
pConsole->Register("friends", "", CFGFLAG_CLIENT, ConFriends, this, "List friends");
}
}
}
示例2: str_copy
void CServerBrowser::SetBaseInfo(class CNetClient *pClient, const char *pNetVersion)
{
m_pNetClient = pClient;
str_copy(m_aNetVersion, pNetVersion, sizeof(m_aNetVersion));
m_pMasterServer = Kernel()->RequestInterface<IMasterServer>();
IConfig *pConfig = Kernel()->RequestInterface<IConfig>();
if(pConfig)
pConfig->RegisterCallback(ConfigSaveCallback, this);
}
示例3: Kernel
void CLua::Init()
{
IConfig *pConfig = Kernel()->RequestInterface<IConfig>();
if(pConfig)
pConfig->RegisterCallback(ConfigSaveCallback, this);
IConsole *pConsole = Kernel()->RequestInterface<IConsole>();
if(pConsole)
{
pConsole->Register("add_lua_file", "s", CFGFLAG_CLIENT, ConAddLuaFile, this, "Add a Lua file");
}
}
示例4: Kernel
void CFriends::Init()
{
IConfig *pConfig = Kernel()->RequestInterface<IConfig>();
if(pConfig)
pConfig->RegisterCallback(ConfigSaveCallback, this);
IConsole *pConsole = Kernel()->RequestInterface<IConsole>();
if(pConsole)
{
pConsole->Register("add_friend", "ss", CFGFLAG_CLIENT, ConAddFriend, this, "Add a friend");
pConsole->Register("remove_Friend", "ss", CFGFLAG_CLIENT, ConRemoveFriend, this, "Remove a friend");
}
}
示例5: LoadConfig
int32_t CCmdHandler::LoadConfig(const char *pConfigName, const char *pFileContent)
{
int32_t nResult = 0;
IConfig *pConfig = g_Frame.GetSafeConfig(pConfigName);
if(pConfig != NULL)
{
nResult = pConfig->Parser((char *)pFileContent);
}
else
{
nResult = -1;
}
return nResult;
}
示例6: Kernel
void CBinds::OnConsoleInit()
{
// bindings
IConfig *pConfig = Kernel()->RequestInterface<IConfig>();
if(pConfig)
pConfig->RegisterCallback(ConfigSaveCallback, this);
Console()->Register("bind", "sr", CFGFLAG_CLIENT, ConBind, this, "Bind key to execute the command");
Console()->Register("unbind", "s", CFGFLAG_CLIENT, ConUnbind, this, "Unbind key");
Console()->Register("unbindall", "", CFGFLAG_CLIENT, ConUnbindAll, this, "Unbind all keys");
Console()->Register("dump_binds", "", CFGFLAG_CLIENT, ConDumpBinds, this, "Dump binds");
// default bindings
SetDefaults();
}
示例7: getFilteredTests
virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector<TestCase>& matchingTestCases ) const {
for( std::vector<TestCase>::const_iterator it = m_functionsInOrder.begin(),
itEnd = m_functionsInOrder.end();
it != itEnd;
++it ) {
if( testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() ) )
matchingTestCases.push_back( *it );
}
}
示例8: getFilteredTests
virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector<TestCase>& matchingTestCases, bool negated = false ) const {
for( std::vector<TestCase>::const_iterator it = m_functionsInOrder.begin(),
itEnd = m_functionsInOrder.end();
it != itEnd;
++it ) {
bool includeTest = testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() );
if( includeTest != negated )
matchingTestCases.push_back( *it );
}
sortTests( config, matchingTestCases );
}
示例9: processInteractive
// Processes interactive option
void Installer::processInteractive()
{
// process all options
IConfig* config = m_factory->getConfig();
// before set any new config file option
// reread config file
config->load();
// look for the option
OptionList options = config->getOptions();
for (OptionList::iterator i = options.begin();
i != options.end(); i++)
{
const std::string name = (*i)->getName();
const std::string oldval = (*i)->getValue();
std::cout << "Option '" << name << "' has the following value: "
<< oldval << std::endl;
if (ask("Do you want to change it [N/y]: "))
{
std::string value = get("New value: ");
setOption((*i)->getName(), value);
}
}
if (ask("Do you want to recreate DB [N/y]: "))
{
recreateDB();
}
// resources detection
if (ask("Do you want to detect resources [N/y]: "))
{
detectResources();
}
}
示例10: sortTests
static void sortTests( IConfig const& config, std::vector<TestCase>& matchingTestCases ) {
switch( config.runOrder() ) {
case RunTests::InLexicographicalOrder:
std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() );
break;
case RunTests::InRandomOrder:
{
RandomNumberGenerator rng;
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
}
break;
case RunTests::InDeclarationOrder:
// already in declaration order
break;
}
}
示例11: sortTests
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
std::vector<TestCase> sorted = unsortedTestCases;
switch( config.runOrder() ) {
case RunTests::InLexicographicalOrder:
std::sort( sorted.begin(), sorted.end() );
break;
case RunTests::InRandomOrder:
seedRng( config );
RandomNumberGenerator::shuffle( sorted );
break;
case RunTests::InDeclarationOrder:
// already in declaration order
break;
}
return sorted;
}
示例12: sortTests
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
std::vector<TestCase> sorted = unsortedTestCases;
switch( config.runOrder() ) {
case RunTests::InLexicographicalOrder:
std::sort( sorted.begin(), sorted.end(), LexSort() );
break;
case RunTests::InRandomOrder:
{
seedRng( config );
std::random_device rng;
std::mt19937 urng(rng());
std::shuffle( sorted.begin(), sorted.end(), rng );
}
break;
case RunTests::InDeclarationOrder:
// already in declaration order
break;
}
return sorted;
}
示例13: matchTest
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
}
示例14: seedRng
void seedRng( IConfig const& config ) {
if( config.rngSeed() != 0 )
std::srand( config.rngSeed() );
}