• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cconfigfile::CVar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: string

// 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:sythaeryn,项目名称:pndrpg,代码行数:8,代码来源:gpm_service.cpp


示例2:

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


示例3:

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


示例4: getValue

double CConfiguration::getValue(const string &varName, double defaultValue)
{
	if (m_ConfigFile.exists(varName)) return m_ConfigFile.getVar(varName).asDouble();
	CConfigFile::CVar varToCopy;
	varToCopy.forceAsDouble(defaultValue);	
	m_ConfigFile.insertVar(varName, varToCopy);
	return defaultValue;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:8,代码来源:configuration.cpp


示例5: getValue

int CConfiguration::getValue(const string &varName, int defaultValue)
{
	if (ConfigFile->exists(varName)) return ConfigFile->getVar(varName).asInt();
	CConfigFile::CVar varToCopy;
	varToCopy.forceAsInt(defaultValue);	
	ConfigFile->insertVar(varName, varToCopy);
	return defaultValue;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:8,代码来源:configuration.cpp


示例6: if

void	cbUpdateMouseListenerConfig(CConfigFile::CVar &var)
{
	if (var.Name == "MouseInvert") MouseListener->setInvertMouseMode(var.asInt() != 0);
	else if (var.Name == "MouseZoomStep") MouseZoomStep = var.asFloat ();
	else if (var.Name == "ViewLagBehind") MouseListener->setViewLagBehind(var.asFloat ());
	else if (var.Name == "ViewHeight") MouseListener->setViewHeight(var.asFloat ());
	else if (var.Name == "ViewTargetHeight") MouseListener->setViewTargetHeight(var.asFloat ());
	else nlwarning ("Unknown variable update %s", var.Name.c_str());
}
开发者ID:mixxit,项目名称:solinia,代码行数:9,代码来源:mouse_listener.cpp


示例7: var12Callback

// this function will be called when the variable var12 will be modified by
// an external program
void var12Callback (CConfigFile::CVar &var)
{
	stringstream str;
	
	for (uint i = 0; i < var.size (); i++)
		str << var.asInt (i) << " ";

	nlinfo("%s modified, new value: %s\n", var.Name.c_str (), str.str().c_str());
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:11,代码来源:main.cpp


示例8: if

void				cbSimVar (CConfigFile::CVar &var)
{
	     if (var.Name == "SimInLag") CUdpSimSock::_InLag = var.asInt ();
	else if (var.Name == "SimInPacketLost") CUdpSimSock::_InPacketLoss = uint8(var.asInt ());
	else if (var.Name == "SimOutLag") CUdpSimSock::_OutLag = var.asInt ();
	else if (var.Name == "SimOutPacketLost") CUdpSimSock::_OutPacketLoss = uint8(var.asInt ());
	else if (var.Name == "SimOutPacketDuplication") CUdpSimSock::_OutPacketDuplication = uint8(var.asInt ());
	else if (var.Name == "SimOutPacketDisordering") CUdpSimSock::_OutPacketDisordering = uint8(var.asInt ());
	else nlstop;
}
开发者ID:mixxit,项目名称:solinia,代码行数:10,代码来源:udp_sim_sock.cpp


示例9: cbRestoreShardOpen

/*
 * Restore Shard Open state from config file or from file if found
 */
void cbRestoreShardOpen(CMessage &msgin, const std::string &serviceName, TServiceId  sid)
{
	// first restore state from config file
	CConfigFile::CVar*	var = IService::getInstance()->ConfigFile.getVarPtr("ShardOpen");
	if (var != NULL)
	{
		setShardOpenState((TShardOpenState)var->asInt());
	}

	// then restore state from state file, if it exists
	cbShardOpenStateFile(ShardOpenStateFile);
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:15,代码来源:ryzom_welcome_service.cpp


示例10:

	/// Set expected instances. Ex: { "TICKS", "FS", "FS", "FS" }
	void		setExpectedInstances( CConfigFile::CVar& var )
	{
		// Reset "expected" counters (but don't clear the map, keep the running instances)
		CInstances::iterator ici;
		for ( ici=_Instances.begin(); ici!=_Instances.end(); ++ici )
		{
			(*ici).second.Expected = 0;
		}
		// Rebuild "expected" counters
		for ( uint i=0; i!=var.size(); ++i )
		{
			++_Instances[var.asString(i)].Expected;
		}
	}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:15,代码来源:ryzom_welcome_service.cpp


示例11: compile

// compile the source files to generate new object files
void CAIManager::compile()
{
	// get the file names of input and output files
	std::string srcFile=CAIFiles::fullSrcFileName(id());
	std::string objFile=CAIFiles::fullObjFileName(id());

	// make sure this file isn't in the ignore list
	CConfigFile::CVar *varPtr;
	varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
	if (varPtr==NULL)
	{
		nlwarning("Cannot compile file '%s' as IgnorePrimitives variable not found in .cfg file: Please add 'IgnorePrimitives={\"\"};' and try again",CAIFiles::fullSrcFileName(id()).c_str());
		return;
	}
	for (uint i=0;i<varPtr->size();++i)
		if (CAIFiles::srcName(id())==CFile::getFilenameWithoutExtension(varPtr->asString(i)))
		{
			nlinfo("Skipping file in .cfg ignoreList: %s",CAIFiles::fullSrcFileName(id()).c_str());
			return;
		}

	// compile the input file
	nlinfo("Compile %s => %s",srcFile.c_str(),objFile.c_str());
	CAIDSActions::CurrentManager=id();
	AI_SHARE::parsePrimFile(srcFile.c_str());

	// make sure this file isn't in the ignore list (if the compiler found nothing interesting it will have been added)
	varPtr=IService::getInstance()->ConfigFile.getVarPtr(std::string("IgnorePrimitives"));
	for (uint i=0;i<varPtr->size();++i)
		if (CAIFiles::srcName(id())==CFile::getFilenameWithoutExtension(varPtr->asString(i)))
		{
			nlinfo("- Skipping file as it has just been added to .cfg ignoreList: %s",CAIFiles::fullSrcFileName(id()).c_str());
			return;
		}

	// write the output file
	CAIFiles::writeObjFile(id());

	// write the binary output file (for debugging only)
	NLMISC::COFile file;
	if (file.open(objFile+"_out"))
	{
		std::string s;
		MgrDfnRootNode.serialToString(s);
		file.serial(s);
		file.close();
	}
	else
		nlwarning("CAIManager::compile(): Failed to open the output file: %s",(objFile+"_out").c_str());
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:51,代码来源:ai_manager.cpp


示例12: 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


示例13: init

//-----------------------------------------------------------------------------
void CBackupService::init()
{
	FileManager.init();

	setUpdateTimeout(100);
	_SaveStall = false;

	// set the connection and disconnection callbacks
	CUnifiedNetwork::getInstance()->setServiceUpCallback( string("*"), cbConnection, 0);
	CUnifiedNetwork::getInstance()->setServiceDownCallback( string("*"), cbDisconnection, 0);

	CUnifiedNetwork::getInstance()->setServiceUpCallback( string("BS"), cbConnection, 0);
	CUnifiedNetwork::getInstance()->setServiceDownCallback( string("BS"), cbDisconnection, 0);

	// Init the sheet Id 
	CSheetId::init(false);

	if (!MasterBSHost.get().empty())
	{
		IService::getInstance()->addStatusTag("SlaveMode");
		IService::getInstance()->setCurrentStatus("WaitingMaster");

		BSIsSlave = true;
		FileManager.forbidStall();
		// I'm a slave, try to contact master
		string	host = MasterBSHost;
		if (host.find (":") == string::npos)
			host += ":49990";

		CUnifiedNetwork::getInstance()->addService ("BS", CInetAddress(host));
	}

	// set the initial read state from the config file
	CConfigFile::CVar *readState = ConfigFile.getVarPtr("BSReadState");
	if (readState != NULL)
		BSReadState = readState->asBool();


	initWebConnection();

	_CallbackServer = new NLNET::CCallbackServer;
	_CallbackServer->addCallbackArray(cbSyncArray, sizeofarray(cbSyncArray));
	// open the layer 3 callback server if required
	if (L3ListeningPort != 0)
		_CallbackServer->init(L3ListeningPort);
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:47,代码来源:backup_service.cpp


示例14: packedFileName

// @{
// \name Overload for IPluginCallback
void		CPrimitivePlugin::init(IPluginAccess *pluginAccess)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	AfxEnableControlContainer();
	_PluginAccess = pluginAccess;

	string packedFileName("primitive_plugin.packed_sheets");

	vector<string>	paths;
	string sheetIdPath;

	// add the search path
	CConfigFile &cf = pluginAccess->getConfigFile();
	CConfigFile::CVar *pv = cf.getVarPtr("PrimitivePluginPath");
	if (pv)
	{
		for (uint i=0; i<pv->size(); ++i)
			paths.push_back(pv->asString(i));
	}
	// add the sheetId file
	pv = cf.getVarPtr("PrimitivePluginSheetId");
	sheetIdPath = pv->asString();

	// Init the sheet id
	CPath::addSearchFile(sheetIdPath);
	CSheetId::init(false);

	// Read the sheets
	if (NLMISC::CFile::fileExists(packedFileName))
		loadForm("creature", packedFileName, _CreatureInfos, false, false);
	else
	{
		for (uint i=0; i<paths.size(); ++i)
		{
			CPath::addSearchPath(paths[i], true, false);
		}

		// build the packed sheet
		loadForm("creature", packedFileName, _CreatureInfos, true, false);
	}

	vector<string>	classNames;
	classNames.push_back("npc_bot");
	_PluginAccess->registerPrimitiveDisplayer(this, classNames);
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:47,代码来源:primitive_plugin.cpp


示例15: loadPlugins

void CWorldEditorApp::loadPlugins()
{
	// 1st load the plugin configuration file
//	char curDir[MAX_PATH];
//	GetCurrentDirectory (MAX_PATH, curDir);

	PluginConfig.load((ExePath+"/world_editor_plugin.cfg").c_str());

	// enumerate the plugin variable.
	CConfigFile::CVar *plugins = PluginConfig.getVarPtr("PluginsLibrary");

	if (plugins != 0)
	{
		for (uint i=0; i<plugins->size(); ++i)
		{
			string libname = plugins->asString(i)+nlLibSuffix+".dll";

			//vl HMODULE h = AfxLoadLibrary(libname.c_str());
			NL_LIB_HANDLE h = nlLoadLibrary(libname.c_str());
			if (h == NULL)
				continue;

			//FCreateSoundPlugin *pf = (FCreateSoundPlugin*) GetProcAddress(h, "createSoundPlugin");
			//JC: switch to the generic call as soon as possible
			//vl FCreatePlugin *pf = (FCreatePlugin*) GetProcAddress(h, "createPlugin");
			FCreatePlugin *pf = (FCreatePlugin*) nlGetSymbolAddress(h, "createPlugin");

			if (pf == NULL)
				continue;

			// ok, the plugin is loaded.
			IPluginCallback *pcb = (IPluginCallback*) pf();

			if (pcb == 0)
				continue;

			nlinfo("Plugins '%s' loaded", libname.c_str());
			Plugins.push_back(pcb);

			// init the plugin.
			pcb->init(getMainFrame());
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:44,代码来源:world_editor.cpp


示例16: cfcbLogFilter

void CConfiguration::cfcbLogFilter(CConfigFile::CVar &var)
{
	// from nel/net/service.cpp	
	CLog *log = NULL;
	if (var.Name == "NegFiltersDebug") log = DebugLog;
	else if (var.Name == "NegFiltersInfo") log = InfoLog;
	else if (var.Name == "NegFiltersWarning") log = WarningLog;
	else if (var.Name == "NegFiltersAssert") log = AssertLog;
	else if (var.Name == "NegFiltersError") log = ErrorLog;
	else nlstop;

	// remove all old filters from config file
	CConfigFile::CVar &oldvar = m_ConfigFile.getVar(var.Name);
	for (uint j = 0; j < oldvar.size(); j++)
		log->removeFilter(oldvar.asString(j).c_str());
	
	// add all new filters from config file
	for (uint i = 0; i < var.size(); i++)
		log->addNegativeFilter(var.asString(i).c_str());
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:20,代码来源:configuration.cpp


示例17: init

void CConfiguration::init()
{	
	// verify data
	nlassert(!m_ConfigCallbacks.size());
	
	// load config
	m_ConfigFile.load(NLQT_CONFIG_FILE);
	
	// log config
	CConfiguration::setAndCallback("NegFiltersDebug", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersInfo", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersWarning", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersAssert", CConfigCallback(this, &CConfiguration::cfcbLogFilter));
	CConfiguration::setAndCallback("NegFiltersError", CConfigCallback(this, &CConfiguration::cfcbLogFilter));

	// set the search paths (kinda important)
	CConfigFile::CVar *var;
	var = m_ConfigFile.getVarPtr("SearchPaths");
	uint varsize = var->size();
	for (uint i = 0; i < varsize; ++i)
		CPath::addSearchPath(var->asString(i), true, false);
	var = m_ConfigFile.getVarPtr("RemapExtensions");
	varsize = var->size();
	for (uint i = 0; i < varsize; i += 2)
		CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:26,代码来源:configuration.cpp


示例18: cbUpdateCompass

void cbUpdateCompass (CConfigFile::CVar &var)
{
	if (var.Name == "CompassPosX") CompassPosX = var.asFloat ();
	else if (var.Name == "CompassPosY") CompassPosY = var.asFloat ();
	else if (var.Name == "CompassRadius") CompassRadius = var.asFloat ();
	else if (var.Name == "CompassColor") 
	{
		CompassColor.set(var.asInt(0), var.asInt(1), var.asInt(2), var.asInt(3));
		CompassMaterial.setColor(CompassColor);
	}
	else nlwarning ("Unknown variable update %s", var.Name.c_str());
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:12,代码来源:compass.cpp


示例19: init

bool CConfiguration::init()
{
	nlassert(!ConfigFile); ConfigFile = new CConfigFile(); nlassert(ConfigFile);
	ConfigFile->load(SBCLIENT_CONFIG_FILE);

	// set the search paths (kinda important)
	CConfigFile::CVar *var;
	var = ConfigFile->getVarPtr("SearchPaths");
	uint varsize = var->size();
	for (uint i = 0; i < varsize; ++i)
		CPath::addSearchPath(var->asString(i), true, false);
	var = ConfigFile->getVarPtr("RemapExtensions");
	varsize = var->size();
	for (uint i = 0; i < varsize; i += 2)
		CPath::remapExtension(var->asString(i), var->asString(i + 1), true);

	return true;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:18,代码来源:configuration.cpp


示例20: cbUpdateSkillsDisplay

void cbUpdateSkillsDisplay (CConfigFile::CVar &var)
{
	if (var.Name == "SkillsDisplayState") SkillsDisplayState = var.asInt ();
}
开发者ID:rbjarnason,项目名称:Mayans,代码行数:4,代码来源:skills_display.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cdt::Face_handle类代码示例发布时间:2022-05-31
下一篇:
C++ cconfig::SubConfig类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap