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


C++ CConfig类代码示例

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


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

示例1: ToString

	void ToString(CString& sRes, CConfig& conf) {
		CConfig::EntryMapIterator it = conf.BeginEntries();
		while (it != conf.EndEntries()) {
			const CString& sKey = it->first;
			const VCString& vsEntries = it->second;
			VCString::const_iterator i = vsEntries.begin();
			if (i == vsEntries.end())
				sRes += sKey + " <- Error, empty list!\n";
			else
				while (i != vsEntries.end()) {
					sRes += sKey + "=" + *i + "\n";
					++i;
				}
			++it;
		}

		CConfig::SubConfigMapIterator it2 = conf.BeginSubConfigs();
		while (it2 != conf.EndSubConfigs()) {
			std::map<CString, CConfigEntry>::const_iterator it3 = it2->second.begin();

			while (it3 != it2->second.end()) {
				sRes += "->" + it2->first + "/" + it3->first + "\n";
				ToString(sRes, *it3->second.m_pSubConfig);
				sRes += "<-\n";
				++it3;
			}

			++it2;
		}
	}
开发者ID:FooBarWidget,项目名称:znc,代码行数:30,代码来源:ConfigTest.cpp

示例2: LoadConf

int LoadConf (const char *p_pszConfDir) {
	int iRetVal = 0;
	std::string strConfDir;
	std::string strConfFile;

	do {
		strConfDir = p_pszConfDir;
		if ('/' != strConfDir[strConfDir.length() - 1]) {
			strConfDir += '/';
		}
		strConfFile = strConfDir + "coam.conf";
		iRetVal = g_coConf.LoadConf (strConfFile.c_str());
		if (iRetVal) { iRetVal = -1; break; }

		std::vector<std::string> vectValList;
		std::vector<std::string>::iterator iterValList;
		CConfig *pcoTmp;

		g_coConf.GetParamValue ("location", vectValList);
		for (iterValList = vectValList.begin(); iterValList != vectValList.end(); ++iterValList) {
			strConfFile = strConfDir + *iterValList;
			pcoTmp = new CConfig;
			iRetVal = pcoTmp->LoadConf (strConfFile.c_str());
			if (iRetVal) { iRetVal = -1; break; }
			g_mapLocationConf.insert (std::make_pair (std::string(*iterValList), pcoTmp));
		}
		if (iRetVal) { break; }
	} while (0);

	return iRetVal;
}
开发者ID:isub,项目名称:coam,代码行数:31,代码来源:coam.cpp

示例3: getenv

bool CConfigPra::LoadCfgFile(const char* a_szCfgFile)
{
	if (a_szCfgFile != NULL) {
		m_strCfgFile = a_szCfgFile;
	} else {
		m_strCfgFile = getenv("HOME");
		m_strCfgFile += "/ATOM/CFG/ATOM.cfg";
	}
	
	CConfig clsCF;
	if (clsCF.Initialize((char*)m_strCfgFile.c_str()) < 0) {
		return false;
	}

	const char* szV = NULL;

	szV = clsCF.GetGlobalConfigValue("LOG_PATH"); if (szV) m_strLogPath = szV;
	//szV = clsCF.GetGlobalConfigValue("DB_HOST"); if (szV) m_strDbIp = szV;
	//szV = clsCF.GetGlobalConfigValue("DB_PORT"); if (szV) m_nDbPort = atoi(szV);
	//szV = clsCF.GetGlobalConfigValue("DB_USER"); if (szV) m_strDbUser = szV;
	//szV = clsCF.GetGlobalConfigValue("DB_PASS"); if (szV) m_strDbPasswd = szV;
	//szV = clsCF.GetGlobalConfigValue("DB_DATABASE"); if (szV) m_strDbName = szV;

	//szV = clsCF.GetConfigValue("PRA", "VNF_WAITTIME");	if (szV) m_nVnfWaitTime = atoi(szV);

	return true;
}
开发者ID:Ntels-sup,项目名称:SRC_ATOM_BE,代码行数:27,代码来源:CConfigPra.cpp

示例4: ERROR

EXPORT_C gint32 CConfigIterator::Current(CDbEntity ** ppEntity)
	{
	if (ppEntity == NULL)
		return ERROR(ESide_Client, EModule_Db, ECode_Invalid_Param);
	
	*ppEntity = NULL;
	if (m_dbQuery->eof())
		return ERROR(ESide_Client, EModule_Db, ECode_Not_Exist);
	
	 /* fill config table fields */
	*ppEntity = new CConfig(m_pEntityDb);
	if (NULL == *ppEntity)
		{
		return ERROR(ESide_Client, EModule_Db, ECode_No_Memory);
		}
	
	CConfig * pConfig = (CConfig*)(*ppEntity);
	for (int i=0; i<ConfigField_EndFlag; i++)
		{
		GString * fieldValue = g_string_new(m_dbQuery->fieldValue(i));
		pConfig->SetFieldValue(i, fieldValue);	
		g_string_free(fieldValue, TRUE);
		}
	
	return 0;
	}
开发者ID:north0808,项目名称:haina,代码行数:26,代码来源:CConfigIterator.cpp

示例5: wWinMain

int APIENTRY wWinMain(HINSTANCE hInstance,
					  HINSTANCE ,
					  LPWSTR    ,
					  int       )
{
	CConfig* config = CConfig::get_instance();
	if (!config->load()) return 0;

	using namespace DuiLib;
	CPaintManagerUI::SetInstance(hInstance);
	CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + L"\\skin");

	HRESULT Hr = ::CoInitialize(nullptr);
	if (FAILED(Hr)) return 0;
	CMainWnd *wnd = new CMainWnd(L"MainWnd.xml");
	wnd->Create(nullptr, L"player", UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
	wnd->ShowModal();

	delete wnd;
	::CoUninitialize();
	
	delete config;
	_CrtDumpMemoryLeaks();
	return 0;
}
开发者ID:captainwong,项目名称:Player,代码行数:25,代码来源:Player.cpp

示例6: Test

	bool Test() {
		CFile &File = WriteFile();
		// Verify that Parse() rewinds the file
		File.Seek(12);

		CConfig conf;
		CString sError;
		bool res = conf.Parse(File, sError);
		if (!res) {
			std::cout << "Error'd out! (" + sError + ")\n";
			return false;
		}
		if (!sError.empty()) {
			std::cout << "Non-empty error string!\n";
			return false;
		}

		CString sOutput;
		ToString(sOutput, conf);

		if (sOutput != m_sOutput) {
			std::cout << "Wrong output\n Expected: " << m_sOutput << "\n Got: " << sOutput << std::endl;
			return false;
		}

		return true;
	}
开发者ID:FooBarWidget,项目名称:znc,代码行数:27,代码来源:ConfigTest.cpp

示例7: Init

void CClient::Run()
{
	Init();

	if(!m_sockMain.Socket()) return;
	if(!m_sockMain.Bind() )  return;

	if(!m_sockOT.Socket()) return;
	if(!m_sockOT.Bind() )  return;

	CConfig* pConfig = CConfig::GetInstance();
	if( !m_sockMain.Connect( pConfig->GetAddrPID(ID_SERVER), pConfig->GetPortPID(ID_SERVER) ) )
		return;

	if( !m_sockOT.Connect( pConfig->GetAddrPID(ID_SERVER), pConfig->GetPortPID(ID_SERVER) )  )
		return;
	 
	m_pThreadOT = new COTThread();
	m_pRecvThread = new CRecvThread();
	
	m_pThreadOT->Start();
	m_pRecvThread->Start();

	RunMainThread();

	m_pThreadOT->Wait();
	m_pRecvThread->Wait();
	
	delete m_pThreadOT; 
	delete m_pRecvThread; 

	Cleanup();
} 
开发者ID:DBMI,项目名称:CountEverything,代码行数:33,代码来源:client.cpp

示例8: CConfig

void CSemanticJudge::loadAnalysis()
{
	int nValue;
	string strValue;
	CConfig *config;

	config = new CConfig();
	if(config->loadConfig(getConfigFile()))
	{
		strValue = config->getValue("ANALYSIS", "total");
		convertFromString(nValue, strValue);
		_log("[CSemanticJudge] CSemanticJudge get analysis total: %d", nValue);
		for(int i = 1; i <= nValue; ++i)
		{
			strValue = config->getValue("ANALYSIS", ConvertToString(i));
			_log("[CSemanticJudge] CSemanticJudge Get conf: %s conf file: %s", ConvertToString(i).c_str(),
					strValue.c_str());
			if(!strValue.empty())
				mapAnalysis[i] = new CAnalysisHandler(strValue.c_str(), this);
		}
	}
	else
	{
		_log("[CSemanticJudge] CSemanticJudge Load Configure Fail, File: %s", getConfigFile().c_str());
	}

	delete config;

	mapSemanticService[0] = new CStory();

	for(unsigned int i = 0; i < mapSemanticService.size(); ++i)
		mapSemanticService[i]->init();
}
开发者ID:ideasiii,项目名称:ControllerPlatform,代码行数:33,代码来源:CSemanticJudge.cpp

示例9: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
	CConfig pConfig;
	pConfig.SetEntryAddr( "12345" );

	return 0;
}
开发者ID:854825967,项目名称:kernel,代码行数:7,代码来源:ComplileError.cpp

示例10: action_toggle_install

void action_toggle_install()
{
    consoleClear();
    CConfig::Mode nextMode = CConfig::Mode::INSTALL_CIA;

    switch (config.GetMode())
    {
        case CConfig::Mode::DOWNLOAD_CIA:
            nextMode = CConfig::Mode::INSTALL_CIA;
        break;
        case CConfig::Mode::INSTALL_CIA:
            nextMode = CConfig::Mode::INSTALL_TICKET;
        break;
        case CConfig::Mode::INSTALL_TICKET:
            nextMode = CConfig::Mode::DOWNLOAD_CIA;
        break;
    }
    
    if (nextMode == CConfig::Mode::INSTALL_TICKET || nextMode == CConfig::Mode::INSTALL_CIA)
    {
        if (!bSvcHaxAvailable)
        {
            nextMode = CConfig::Mode::DOWNLOAD_CIA;
            printf(CONSOLE_RED "Kernel access not available.\nCan't enable Install modes.\nYou can only make a CIA.\n" CONSOLE_RESET);
            wait_key_specific("\nPress A to continue.", KEY_A);
        }
    }

    config.SetMode(nextMode);
}
开发者ID:lavanoid,项目名称:CIAngel,代码行数:30,代码来源:main.cpp

示例11: AddConfiguration

CConfig* CLibrary::AddConfiguration(char* szConfig)
{
	CConfig* pcConfig;

	pcConfig = mcConfigs.InsertAfterTail();
	pcConfig->Init(szConfig);
	return pcConfig;
}
开发者ID:andrewpaterson,项目名称:Codaphela.Library,代码行数:8,代码来源:Library.cpp

示例12: TEST_ERROR

	void TEST_ERROR(const CString& sConfig, const CString& sExpectError) {
		CFile &File = WriteFile(sConfig);

		CConfig conf;
		CString sError;
		EXPECT_FALSE(conf.Parse(File, sError));

		EXPECT_EQ(sExpectError, sError);
	}
开发者ID:54lman,项目名称:znc,代码行数:9,代码来源:ConfigTest.cpp

示例13: init_process

void CManager::init_process() {
    CConfig config;
    std::vector<int> vSWPort;
    std::vector<int> vQWPort;
    std::vector<int> vSRPort;
    std::vector<int> vQRPort;

    std::cout << "********** Process Initialization **********" << std::endl;
    config.read_process(m_vpart, m_filepath); //lecture des process a créer
    config.read_communication(m_vpart, m_compath);

    std::cout << "There are :" << m_vpart.size() << " partitions " << std::endl;
    std::cout << "   ***** Partitions parameters *****" << std::endl;

    for (unsigned int i = 0; i < m_vpart.size(); i++) {
        //on vide la mémoire des vectors
        vSWPort.clear();
        std::vector<int>(vSWPort).swap(vSWPort);

        vQWPort.clear();
        std::vector<int>(vQWPort).swap(vQWPort);

        vSRPort.clear();
        std::vector<int>(vSRPort).swap(vSRPort);

        vQRPort.clear();
        std::vector<int>(vQRPort).swap(vQRPort);


        std::cout << "name Process : " << (m_vpart[i]).nameProcess() << std::endl;
        std::cout << "path Process : " << (m_vpart[i]).pathProcess() << std::endl;
        std::cout << "time processing : " << (m_vpart[i]).time() << std::endl;

        vSWPort = (m_vpart[i]).get_wSport();
        for (unsigned int j = 0; j < vSWPort.size(); j++) {
            std::cout << " can write in sampling port number :" << vSWPort[j] << std::endl;
        }

        vQWPort = (m_vpart[i]).get_wQport();
        for (unsigned int j = 0; j < vQWPort.size(); j++) {
            std::cout << " can read in queuing port :" << vQWPort[j] << std::endl;
        }

        vSRPort = (m_vpart[i]).get_rSport();
        for (unsigned int j = 0; j < vSRPort.size(); j++) {
            std::cout << " sampling associated partion :" << vSRPort[j] << std::endl;
        }

        vQRPort = (m_vpart[i]).get_rQport();
        for (unsigned int j = 0; j < vQRPort.size(); j++) {
            std::cout << " queuing associated partion :" << vQRPort[j] << std::endl;
        }

        std::cout << "********** End of process initialization **********" << std::endl;
    }

}
开发者ID:ARISSIM,项目名称:ARISS,代码行数:57,代码来源:CManager.cpp

示例14: qDebug

void CConfig::remove(const QString &name, const QString &path)
{
#ifdef DEBUG
  qDebug("static CConfig::remove('%s', '%s')", debug_string(name), debug_string(path));
#endif
  
  CConfig *c = new CConfig(name, path);
  c->remove();
  delete c;
}
开发者ID:soundgnome,项目名称:mysqlcc,代码行数:10,代码来源:CConfig.cpp

示例15: loadConfig

void loadConfig()
{
    // Load config, and force mode to DOWNLOAD_CIA if svcHax not available, then resave
    config.LoadConfig("/CIAngel/config.json");
    if (!bSvcHaxAvailable)
    {
        config.SetMode(CConfig::Mode::DOWNLOAD_CIA);
    }
    config.SaveConfig();
}
开发者ID:lavanoid,项目名称:CIAngel,代码行数:10,代码来源:main.cpp


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