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


C++ IConfig类代码示例

本文整理汇总了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");
		}
	}
}
开发者ID:AllTheHaxx,项目名称:AllTheHaxx,代码行数:27,代码来源:friends.cpp

示例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);
}
开发者ID:949f45ac,项目名称:atwmodr3,代码行数:9,代码来源:srvbrowse.cpp

示例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");
	}
}
开发者ID:BugsBunny1605,项目名称:N-Client,代码行数:11,代码来源:lua.cpp

示例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");
	}
}
开发者ID:Nierok,项目名称:teeworlds,代码行数:13,代码来源:friends.cpp

示例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;
}
开发者ID:brianserv,项目名称:frame,代码行数:14,代码来源:cmd_handler.cpp

示例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();
}
开发者ID:wthnonck,项目名称:tdtw,代码行数:15,代码来源:binds.cpp

示例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 );
     }
 }
开发者ID:martinmoene,项目名称:Catch,代码行数:9,代码来源:catch_test_case_registry_impl.hpp

示例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 );
        }
开发者ID:jubalh,项目名称:Catch,代码行数:12,代码来源:catch_test_case_registry_impl.hpp

示例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();
    }
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例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;
            }
        }
开发者ID:jubalh,项目名称:Catch,代码行数:17,代码来源:catch_test_case_registry_impl.hpp

示例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;
    }
开发者ID:Corvusoft,项目名称:catch-dependency,代码行数:18,代码来源:catch_test_case_registry_impl.cpp

示例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;
    }
开发者ID:cmaughan,项目名称:Catch,代码行数:23,代码来源:catch_test_case_registry_impl.hpp

示例13: matchTest

 bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
     return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
 }
开发者ID:cjd,项目名称:wxwidgets31,代码行数:3,代码来源:catch_test_case_registry_impl.hpp

示例14: seedRng

 void seedRng( IConfig const& config ) {
     if( config.rngSeed() != 0 )
         std::srand( config.rngSeed() );
 }
开发者ID:crazii,项目名称:mameui,代码行数:4,代码来源:catch_common.hpp


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