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


C++ CConfigFile类代码示例

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


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

示例1: ExportCallBack

void CALLBACK  ExportCallBack(LONG lPlayHandle, DWORD dwTotalSize, DWORD dwDownLoadSize, DWORD dwUser)
{
	CConfigFile* dlg = (CConfigFile*)dwUser;
	if(NULL == dlg)
	{
		return;
	}

	if (-1 != dwDownLoadSize)	//Exporting data
	{
		if (dwDownLoadSize > 0)
		{
			dlg->m_progressExport.SetPos(dwTotalSize*100/dwDownLoadSize);
		}
	}
	else	//Export process completed
	{
		CLIENT_StopExportCfgFile(dlg->m_lExport);

		dlg->m_progressExport.SetPos(0);

		((CButton*)dlg->GetDlgItem(IDC_BUTTON_IMPORT))->EnableWindow(TRUE);
		((CButton*)dlg->GetDlgItem(IDC_BUTTON_STOP_IMPORT))->EnableWindow(FALSE);

		((CButton*)dlg->GetDlgItem(IDC_BUTTON_EXPORT))->EnableWindow(TRUE);
		((CButton*)dlg->GetDlgItem(IDC_BUTTON_STOP_EXPORT))->EnableWindow(FALSE);
	}

//	dlg->m_dwExportTotalSize = dwTotalSize;
//	dlg->m_dwExportDownloadSize = dwDownLoadSize;
}
开发者ID:dalinhuang,项目名称:demodemo,代码行数:31,代码来源:ConfigFile.cpp

示例2: ReadConfigFile

/*
	Read config file.
*/
int CControlLogic::ReadConfigFile(void)
{

	CConfigFile ConfigFile;
	if(ConfigFile.GetLoadConfigFile((char *)"downFile.txt"))
	    return (ConfigFile.PerformParse((char *)"ambtconfig.txt"));
	else
	    return 0;
}
开发者ID:zfh1005,项目名称:multi_DUT,代码行数:12,代码来源:ControlLogic.cpp

示例3: CConfigFile

//-------------------------------------------------------------------------
// y-func : get_header_data
//-------------------------------------------------------------------------
std::string CyParser::func_set_language(CyhookHandler *, std::string para) {
	if (para != "") {
		CConfigFile *Config = new CConfigFile(',');
		Config->loadConfig(HTTPD_CONFIGFILE);
		Config->setString("Language.selected", para);
		Config->saveConfig(HTTPD_CONFIGFILE);
		yhttpd_reload_config();
	}
	return "";
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:13,代码来源:mod_yparser.cpp

示例4: Destroy

bool
CProject::Open(const char* filename)
{
  Destroy();
  // set the game directory
  m_Directory = filename;
  if (m_Directory.rfind('\\') != std::string::npos)
    m_Directory[m_Directory.rfind('\\')] = 0;
  // set the game filename
  m_Filename = filename;
  if (1) {
    char directory[MAX_PATH];
    GetCurrentDirectory(MAX_PATH, directory);
    if (SetCurrentDirectory(m_Directory.c_str()) == 0)
      return false;
    FILE* file = fopen(m_Filename.c_str(), "a");
    if (!file) return false;
    fclose(file);
    SetCurrentDirectory(directory);
  }
  // load the game.sgm
  CConfigFile config;
  if (!config.Load(m_Filename.c_str()))
    return false;
  m_GameTitle   = config.ReadString("", "name",        "Untitled");
  m_Author      = config.ReadString("", "author",      "Unknown");
  m_Description = config.ReadString("", "description", "");
  m_GameScript = config.ReadString("", "script", "");
  // screen dimensions
  m_ScreenWidth  = config.ReadInt("", "screen_width", 320);
  m_ScreenHeight = config.ReadInt("", "screen_height", 240);
  RefreshItems();
  return true;
}
开发者ID:FlyingJester,项目名称:sphere,代码行数:34,代码来源:Project.cpp

示例5: CConfigFile

void CTimerManager::saveEventsToConfig()
{
	CConfigFile *config = new CConfigFile(',');
	config->clear();
	CTimerEventMap::iterator pos = events.begin();
	for(;pos != events.end();pos++)
	{
		CTimerEvent *event = pos->second;
		event->saveToConfig(config);
	}
	config->saveConfig(CONFIGFILE);
	delete config;

}
开发者ID:GWARDAR,项目名称:OpenPLi-1,代码行数:14,代码来源:timermanager.cpp

示例6: load

	// -----------------------------------------------------------------------
	bool load (const string &sFilename)
	{
		FILE * f = fopen (sFilename.c_str(), "rt");
		if (f == NULL)
			return false;
		else 
			fclose (f);

		try
		{			
			CConfigFile cf;

			cf.load (sFilename);

			// Out
			CConfigFile::CVar &cvOutputIGDir = cf.getVar("OutputIGDir");
			OutputIGDir = cvOutputIGDir.asString();

			// In
			CConfigFile::CVar &cvInputIGDir = cf.getVar("InputIGDir");
			InputIGDir = cvInputIGDir.asString();

			CConfigFile::CVar &cvCellSize = cf.getVar("CellSize");
			CellSize = cvCellSize.asFloat();

			CConfigFile::CVar &cvHeightMapFile1 = cf.getVar("HeightMapFile1");
			HeightMapFile1 = cvHeightMapFile1.asString();

			CConfigFile::CVar &cvZFactor1 = cf.getVar("ZFactor1");
			ZFactor1 = cvZFactor1.asFloat();

			CConfigFile::CVar &cvHeightMapFile2 = cf.getVar("HeightMapFile2");
			HeightMapFile2 = cvHeightMapFile2.asString();

			CConfigFile::CVar &cvZFactor2 = cf.getVar("ZFactor2");
			ZFactor2 = cvZFactor2.asFloat();

			CConfigFile::CVar &cvLandFile = cf.getVar("LandFile");
			LandFile = cvLandFile.asString();
		}
		catch (const EConfigFile &e)
		{
			string sTmp = string("ERROR : Error in config file : ") + e.what() + "\n";
			outString (sTmp);
			return false;
		}
		return true;
	}
开发者ID:sythaeryn,项目名称:pndrpg,代码行数:49,代码来源:main.cpp

示例7: getVarFromConfigFile

// String version
bool	getVarFromConfigFile(CConfigFile &cf, const string &name, string &variable, const string &defaultValue = string(""))
{
	CConfigFile::CVar	*ptr = cf.getVarPtr(name);
	bool	success;
	variable = ((success = (ptr != NULL)) ? ptr->asString() : defaultValue);
	return success;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:8,代码来源:gpm_service.cpp

示例8: LoadKeyCfg

void LoadKeyCfg ()
{
	// Path of the dll
	HMODULE hModule = hInstance;
	if (hModule)
	{
		char sModulePath[256];
		int res=GetModuleFileName(hModule, sModulePath, 256);
		if (res)
		{
			// split path
			char drive[256];
			char dir[256];
			_splitpath (sModulePath, drive, dir, NULL, NULL);

			// Make a new path
			char cgfPath[256];
			_makepath (cgfPath, drive, dir, "keys", ".cfg");

	
			CConfigFile cf;

			// Load and parse "test.txt" file
			cf.load (cgfPath);
			
			// For each keys
			for (uint key=0; key<KeyCounter; key++)
			{
				// go
				try
				{
					// Get the foo variable (suppose it's a string variable)
					CConfigFile::CVar &value= cf.getVar (PainterKeysName[key]);

					// Get value
					PainterKeys[key]=value.asInt ();
				}
				catch (EConfigFile &e)
				{
					// Something goes wrong... catch that
					const char* what=e.what();
				}
			}
		}
	}
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:46,代码来源:paint_ui.cpp

示例9: trim

bool CBuildInfo::HasData()
{
	v_info.clear();

#ifdef USED_COMPILER
	build_info_t compiler = {BI_TYPE_ID_USED_COMPILER, LOCALE_BUILDINFO_COMPILED_WITH, USED_COMPILER};
	v_info.push_back(compiler);
#endif

#ifdef USED_CXXFLAGS
	string cxxflags = USED_CXXFLAGS;
	cxxflags = trim(cxxflags);
	// Remove double spaces
	size_t pos = cxxflags.find("  ");
	while (pos != string::npos) {
		cxxflags.erase(pos, 1);
		pos = cxxflags.find("  ", pos);
	}
	build_info_t flags = {BI_TYPE_ID_USED_CXXFLAGS, LOCALE_BUILDINFO_COMPILER_FLAGS, cxxflags};
	v_info.push_back(flags);
#endif

#ifdef USED_BUILD
	build_info_t build = {BI_TYPE_ID_USED_BUILD , LOCALE_BUILDINFO_COMPILED_ON, USED_BUILD};
	v_info.push_back(build);
#endif

	CComponentsText utext;
	build_info_t kernel = {BI_TYPE_ID_USED_KERNEL, LOCALE_BUILDINFO_KERNEL, utext.getTextFromFile("/proc/version")};
	v_info.push_back(kernel);

#if 0
	CConfigFile data ('\t');
	data.loadConfig("/.version");
	build_info_t creator	= {BI_TYPE_ID_CREATOR, LOCALE_BUILDINFO_CREATOR, data.getString("creator", "n/a")};
	v_info.push_back(creator);
#endif

	if (v_info.empty()){
		DisplayInfoMessage("No Informations available. Please report!");
		return false;
	}

	return true;
}
开发者ID:Coolstreamto,项目名称:Coolto,代码行数:45,代码来源:buildinfo.cpp

示例10: SetCurrentDirectory

bool
CProject::Save() const
{
  SetCurrentDirectory(m_Directory.c_str());
  
  CConfigFile config;
  config.Load(m_Filename.c_str());
  config.WriteString("", "name", m_GameTitle.c_str());
  config.WriteString("", "author", m_Author.c_str());
  config.WriteString("", "description", m_Description.c_str());
  config.WriteString("", "script", m_GameScript.c_str());
  // screen dimensions
  config.WriteInt("", "screen_width",  m_ScreenWidth);
  config.WriteInt("", "screen_height", m_ScreenHeight);
  config.Save(m_Filename.c_str());
  return true;
}
开发者ID:FlyingJester,项目名称:sphere,代码行数:17,代码来源:Project.cpp

示例11: CConfigFile

//=============================================================================
// y-func : Functions for Neutrino
//=============================================================================
//-------------------------------------------------------------------------
// y-func : mount_get_list
//-------------------------------------------------------------------------
std::string  CNeutrinoYParser::func_mount_get_list(CyhookHandler *, std::string)
{
	CConfigFile *Config = new CConfigFile(',');
	std::string ysel, ytype, yip, ylocal_dir, ydir, ynr, yresult;
	int yitype;

	Config->loadConfig(NEUTRINO_CONFIGFILE);
	for(unsigned int i=0; i <= 7; i++)
	{
		ynr=itoa(i);
		ysel = ((i==0) ? "checked=\"checked\"" : "");
		yitype = Config->getInt32("network_nfs_type_"+ynr,0);
		ytype = ( (yitype==0) ? "NFS" :((yitype==1) ? "CIFS" : "FTPFS") );
		yip = Config->getString("network_nfs_ip_"+ynr,"");
		ydir = Config->getString("network_nfs_dir_"+ynr,"");
		ylocal_dir = Config->getString("network_nfs_local_dir_"+ynr,"");
		if(ydir != "")
			ydir="("+ydir+")";

		yresult += string_printf("<input type='radio' name='R1' value='%d' %s />%d %s - %s %s %s<br/>",
			i,ysel.c_str(),i,ytype.c_str(),yip.c_str(),ylocal_dir.c_str(), ydir.c_str());
	}
	delete Config;
	return yresult;
}
开发者ID:Coolstreamto,项目名称:Coolto,代码行数:31,代码来源:neutrinoyparser.cpp

示例12: LoadConfiguration

void LoadConfiguration(std::string sphere_dir)
{
    CConfigFile file;
    file.Load((sphere_dir + "/system/video/sdl32.cfg").c_str());

    Config.fullscreen = file.ReadBool("sdl32", "Fullscreen", false);
    Config.vsync      = file.ReadBool("sdl32", "VSync",      false);
    Config.scale      = file.ReadBool("sdl32", "Scale",      false);
    Config.filter     = file.ReadInt ("sdl32", "Filter",        0);

    int vexpand       = file.ReadInt ("sdl32", "VExpand",       0);
    int hexpand       = file.ReadInt ("sdl32", "HExpand",       0);

    if (vexpand < 0 || vexpand > 1024)
        vexpand = 0;

    if (hexpand < 0 || hexpand > 1024)
        hexpand = 0;

    Config.border.top    = (int)(vexpand / 2);
    Config.border.bottom = (int)(vexpand / 2) + (vexpand % 2);
    Config.border.left   = (int)(hexpand / 2);
    Config.border.right  = (int)(hexpand / 2) + (hexpand % 2);

}
开发者ID:FlyingJester,项目名称:sphere,代码行数:25,代码来源:sdl32.cpp

示例13: init

void	init()
{
	registerSerial3d();

	try
	{
#ifdef NL_OS_UNIX
	        std::string homeDir = getenv("HOME");
        	NLMISC::CPath::addSearchPath( homeDir + "/.nel");
#endif // NL_OS_UNIX

	        NLMISC::CPath::addSearchPath(NL_BIB_CFG);

		CConfigFile cf;
		uint			i;
	
		cf.load("build_ig_boxes.cfg");
	
		Output = getString(cf, "Output");
		// nlinfo("Output=%s", Output.c_str());

		CConfigFile::CVar &cvIGs = cf.getVar("IGs");
		for (i=0; i<cvIGs.size(); i++)
		{
			IGs.push_back(cvIGs.asString(i));
		}

		CConfigFile::CVar &cvPathes = cf.getVar("Pathes");
		for (i=0; i<cvPathes.size(); ++i)
		{
			nlinfo("Using search path %s", cvPathes.asString(i).c_str());
			CPath::addSearchPath(cvPathes.asString(i));
		}
	}
	catch (EConfigFile &e)
	{
		printf ("Problem in config file : %s\n", e.what ());
	}
}
开发者ID:mixxit,项目名称:solinia,代码行数:39,代码来源:main.cpp

示例14: main

int main(int argc, char* argv[])
{

    //_CrtSetBreakAlloc(157);
    try
    {
        CConfigFile configXMLFile;
        CSimionApp* pApp = 0;
        //initialisation required for all apps: create the comm pipe and load the xml configuration file, ....
        if (argc > 2)
            CLogger::createOutputPipe(argv[2]);

        if (argc <= 1)
            CLogger::logMessage(MessageType::Error, "Too few parameters: no config file provided");

        CConfigNode* pParameters= configXMLFile.loadFile(argv[1]);
        if (!pParameters) throw std::exception("Wrong experiment configuration file");

        if (!strcmp("RLSimion", pParameters->getName()))
            pApp = new RLSimionApp(pParameters);

        if (pApp)
        {
            pApp->setOutputDirectory(argv[1]);

            pApp->run();

            delete pApp;
        }
        else throw std::exception("Wrong experiment configuration file");
    }
    catch (std::exception& e)
    {
        CLogger::logMessage(MessageType::Error, e.what());
    }
    //_CrtDumpMemoryLeaks();
    return 0;
}
开发者ID:borjafdezgauna,项目名称:RLSimion,代码行数:38,代码来源:rlsimion.cpp

示例15: generateSpellList

/** Generate list of spell
  */
static void generateSpellList(CConfigFile &cf, const std::string &sheetName)
{
	CConfigFile::CVar *spellList = cf.getVarPtr("spell_list");
	if (!spellList)
	{
		nlwarning("Can't read spell list");
		return;
	}	
	COFile f;
	if (!f.open(sheetName, false, true))
	{
		nlwarning("Can't write %s", sheetName.c_str());
		return;
	}
	try
	{	
		COXml xmlStreamOut;
		xmlStreamOut.init(&f);
		xmlStreamOut.xmlPush("FORM");
		IStream &xmlStream = xmlStreamOut;
		xmlStream.xmlPush("STRUCT");
		xmlStream.xmlPushBegin("ARRAY");
			xmlStream.xmlSetAttrib("Name");
			std::string name = "List";
			xmlStream.serial(name);					
		xmlStream.xmlPushEnd();				
		for(uint k = 0; k < (uint) spellList->size(); ++k)
		{
			std::vector<std::string> result;
			NLMISC::splitString(spellList->asString(k), "|", result);
			if (result.size()  < 2)
			{
				nlwarning("Should provide at list spell name and id");
			}
			xmlStream.xmlPush("STRUCT");				
				writeAtom(xmlStream, "ID", result[1]);
				writeAtom(xmlStream, "SheetBaseName", result[0]);
			xmlStream.xmlPop();
		}
		xmlStream.xmlPop(); // STRUCT
		xmlStream.xmlPop(); // FORM
	}
	catch(const EStream &)
	{
		nlwarning("Cant write %s", sheetName.c_str());
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:49,代码来源:build_spell_sheet.cpp


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