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


C++ ConfigFile::Get方法代码示例

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


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

示例1: System

PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
    : System(params)
    , m_DbgConfigForceRespawn(false)
{
    EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
    EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
    EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerSpawnSystem::OnPlayerDeath);
    ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
    m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
    m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
    m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0 && IsServer;
}
开发者ID:FakeShemp,项目名称:TacticalZ,代码行数:12,代码来源:PlayerSpawnSystem.cpp

示例2: Init

void Frontend::Init(Communicator *c) {
#if 1
    const char *config_file;
#ifdef _CONFIG_FILE
    if((config_file = getenv("CONFIG_FILE")) == NULL)
        config_file = _CONFIG_FILE;
#else
	config_file = "gvirtus.properties";
#endif
    ConfigFile *cf = new ConfigFile(config_file);
    string communicator;
#ifndef _WIN32
    char *tmp;
	if((tmp = getenv("COMMUNICATOR")) != NULL)
        communicator = string(tmp);
    else
#endif
    communicator = cf->Get("communicator");
    mpCommunicator = Communicator::Get(communicator);
#else
    mpCommunicator = c;
#endif

    mpCommunicator->Connect();
    mpInputBuffer = new Buffer();
    mpOutputBuffer = new Buffer();
    mpLaunchBuffer = new Buffer();
    mExitCode = -1;
    initialized = true;
}
开发者ID:RapidProjectH2020,项目名称:GVirtuS,代码行数:30,代码来源:Frontend.cpp

示例3: Load

bool Config::Load(){

  serverPort = 666;
  isPublic = true;
  memset(serverName,0,SERVERNAME_MAX); sprintf(serverName,"G Server");
  enableLogging = true;
  ignoreUnknownPackets = false;
  spriteMaxX = 50;
  spriteMaxY = 50;
  usernameMax = 20;

  ConfigFile file; file.Construct();

  if(file.Load(CONFIG_FILE)){
    file.Get("serverPort",&serverPort);
    file.Get("isPublic",&isPublic);
    file.Get("serverName",serverName,SERVERNAME_MAX);
    file.Get("enableLogging",&enableLogging);
    file.Get("ignoreUnknownPackets",&ignoreUnknownPackets);
    file.Get("spriteMaxX",&spriteMaxX);
    file.Get("spriteMaxY",&spriteMaxY);
    file.Get("usernameMax",&usernameMax);
  }else{
    fprintf(stderr,"WARNING: %s not found. Generating with default settings.\n",CONFIG_FILE);
  }

  file.Clear();
  file.Set("serverPort",serverPort);
  file.Set("isPublic",isPublic);
  file.Set("serverName",serverName);
  file.Set("enableLogging",enableLogging);
  file.Set("ignoreUnknownPackets",ignoreUnknownPackets);
  file.Set("spriteMaxX",spriteMaxX);
  file.Set("spriteMaxY",spriteMaxY);
  file.Set("usernameMax",usernameMax);

  if(file.Save(CONFIG_FILE)){
    file.Destruct();
    return true;
  }else{
    fprintf(stderr,"ERROR: Unable to save %s.\n",CONFIG_FILE);
    file.Destruct();
    return false;
  }

}
开发者ID:stal888,项目名称:gnet,代码行数:46,代码来源:global.cpp

示例4: if

	Core::Core(const string& cLog, const string& cConfig)
		: CoreObject("CORE", new ofstream(cLog), WorkPriority::WP_MAIN)
	{
		mLogger = mOutFileStream;
		m_pRenderSystem = nullptr;
		m_pInputSystem = nullptr;
		m_pFileSystem = nullptr;

		AddSystem(new FileSystem(mLogger), true);

		ConfigFile* config = new ConfigFile(cConfig, mLogger);
		for (auto it : config->Get())
		{
			if (it.first == "load_module")
			{
				LoadModule(it.second);
			}
			else if (it.first == "set_render_system")
			{
				if (it.second == "11.2")
				{
					ChangeSystem(SystemsType::SYSTEM_RENDER_DIRECTX_11_2);
				}
				else
				{
					DrawLine("Core: Íåâåðíûé ïàðàìåòîð! set_render_system");
				}
			}
			else if (it.first == "set_input_system")
			{
				ChangeSystem(SystemsType::SYSTEM_INPUT_DX);
			}
			else if (it.first == "load_resource_folder")
			{
				m_pFileSystem->AddResourceFolder(it.second);
			}
		}

		DrawLine("Core: Çàãðóçêà çàâåðøåíà!");
	}
开发者ID:LeonDEXZ,项目名称:Bloodstone-Engine,代码行数:40,代码来源:DEXCore.cpp


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