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


C++ CInifile类代码示例

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


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

示例1:

//-----------------------------------------------------------------------------
// Environment ambient
//-----------------------------------------------------------------------------
void CEnvAmbient::SSndChannel::load(CInifile& config, LPCSTR sect)
{
    m_load_section = sect;

    m_sound_dist.x = config.r_float(m_load_section, "min_distance");
    m_sound_dist.y = config.r_float(m_load_section, "max_distance");
    m_sound_period.x = config.r_s32(m_load_section, "period0");
    m_sound_period.y = config.r_s32(m_load_section, "period1");
    m_sound_period.z = config.r_s32(m_load_section, "period2");
    m_sound_period.w = config.r_s32(m_load_section, "period3");

    // m_sound_period = config.r_ivector4(sect,"sound_period");
    R_ASSERT(m_sound_period.x <= m_sound_period.y && m_sound_period.z <= m_sound_period.w);
    // m_sound_period.mul (1000);// now in ms
    // m_sound_dist = config.r_fvector2(sect,"sound_dist");
    R_ASSERT2(m_sound_dist.y > m_sound_dist.x, sect);

    LPCSTR snds = config.r_string(sect, "sounds");
    u32 cnt = _GetItemCount(snds);
    string_path tmp;
    R_ASSERT3(cnt, "sounds empty", sect);

    m_sounds.resize(cnt);

    for (u32 k = 0; k < cnt; ++k)
    {
        _GetItem(snds, k, tmp);
        m_sounds[k].create(tmp, st_Effect, sg_SourceType);
    }
}
开发者ID:denanden,项目名称:xray-16,代码行数:33,代码来源:Environment_misc.cpp

示例2: _load_

void TDB_packer::_load_(const xr_string& fname)
{
    	lbIncludeFolders->Items->Clear		();
    	lbIncludeFiles->Items->Clear		();

     	CInifile ini						(fname.c_str());

        if(ini.section_exist("include_folders"))
        {
           CInifile::Sect S 		= ini.r_section("include_folders");
           CInifile::SectCIt it 		= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFolders->Items->Add	(ws);
           }
        }
        if(ini.section_exist("include_files"))
        {
           CInifile::Sect S 		= ini.r_section("include_files");
           CInifile::SectCIt it 	= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFiles->Items->Add	(ws);
           }
        }
        Caption	=	fname.c_str();
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:33,代码来源:FrmDBXpacker.cpp

示例3:

void SThunderboltDesc::load						(CInifile& pIni, shared_str const& sect)
{
	create_top_gradient			(pIni, sect);
	create_center_gradient		(pIni, sect);

	name						= sect;
	color_anim					= LALib.FindItem (pIni.r_string ( sect,"color_anim" ));
	VERIFY						(color_anim);
	color_anim->fFPS			= (float)color_anim->iFrameCount;

    // models
	LPCSTR m_name;
	m_name						= pIni.r_string(sect,"lightning_model");
	m_pRender->CreateModel		(m_name);

	/*
    IReader* F			= 0;
	F					= FS.r_open("$game_meshes$",m_name); R_ASSERT2(F,"Empty 'lightning_model'.");
	l_model				= ::Render->model_CreateDM(F);
    FS.r_close			(F);
	*/

    // sound
	m_name				= pIni.r_string(sect,"sound");
    if (m_name&&m_name[0]) snd.create(m_name,st_Effect,sg_Undefined);
}
开发者ID:2asoft,项目名称:xray,代码行数:26,代码来源:thunderbolt.cpp

示例4: CInifile

void manager::load			()
{
	string_path				file_name;
	CInifile*				config =
		new CInifile(
			FS.update_path(
				file_name,
				"$game_config$",
				"environment\\sound_channels.ltx"
			),
			TRUE,
			TRUE,
			FALSE
		);

	VERIFY					(m_channels.empty());

	typedef CInifile::Root	sections_type;
	sections_type&			sections = config->sections();
	m_channels.reserve		(sections.size());
	sections_type::const_iterator	i = sections.begin();
	sections_type::const_iterator	e = sections.end();
	for ( ; i != e; ++i) {
		channel*			object = new channel(*this, (*i)->Name);
		object->load		(*config);
		object->fill		(m_collection);
		m_channels.push_back(object);
	}

	xr_delete				(config);
}
开发者ID:2asoft,项目名称:xray,代码行数:31,代码来源:editor_environment_sound_channels_manager.cpp

示例5: attach_Actor

bool CCar::attach_Actor(CGameObject* actor)
{
	if(Owner()||CPHDestroyable::Destroyed()) return false;
	CHolderCustom::attach_Actor(actor);

	IKinematics* K	= smart_cast<IKinematics*>(Visual());
	CInifile* ini	= K->LL_UserData();
	int id;
	if(ini->line_exist("car_definition","driver_place"))
		id=K->LL_BoneID(ini->r_string("car_definition","driver_place"));
	else
	{	
		Owner()->setVisible(0);
		id=K->LL_GetBoneRoot();
	}
	CBoneInstance& instance=K->LL_GetBoneInstance				(u16(id));
	m_sits_transforms.push_back(instance.mTransform);
	OnCameraChange(ectFirst);
	PPhysicsShell()->Enable();
	PPhysicsShell()->add_ObjectContactCallback(ActorObstacleCallback);
//	VisualUpdate();
	processing_activate();
	ReleaseHandBreak();
//	CurrentGameUI()->UIMainIngameWnd->CarPanel().Show(true);
//	CurrentGameUI()->UIMainIngameWnd->CarPanel().SetCarHealth(fEntityHealth/100.f);
	//CurrentGameUI()->UIMainIngameWnd.ShowBattery(true);
	//CBoneData&	bone_data=K->LL_GetData(id);
	//Fmatrix driver_pos_tranform;
	//driver_pos_tranform.setHPB(bone_data.bind_hpb.x,bone_data.bind_hpb.y,bone_data.bind_hpb.z);
	//driver_pos_tranform.c.set(bone_data.bind_translate);
	//m_sits_transforms.push_back(driver_pos_tranform);
	//H_SetParent(actor);

	return true;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:35,代码来源:Car.cpp

示例6: ebLoadFromClick

void __fastcall TfrmBonePart::ebLoadFromClick(TObject *Sender)
{
//.
    xr_string temp_fn;
    if (EFS.GetOpenName	( _import_, temp_fn, false, NULL, 0))
    {
        ebClearClick	(Sender);
        CInifile ini	(temp_fn.c_str(), TRUE, TRUE, FALSE);
        string64		buff;
        for(int i=0; i<4; ++i)
        {
            sprintf	(buff,"part_%d",i);
            LPCSTR part_name = ini.r_string(buff, "partition_name");
            E[i]->Text = part_name;
            CInifile::Sect& S 	= ini.r_section(buff);
            CInifile::SectCIt it = S.Data.begin();
            CInifile::SectCIt e = S.Data.end();
            for (; it!=e; ++it)
            {
                if( 0!= stricmp(it->first.c_str(), "partition_name") )
                {
                    FHelper.AppendObject(T[i], it->first.c_str(), false, true);
                }
            }

        }
    }
}
开发者ID:Frankie-666,项目名称:xray-16,代码行数:28,代码来源:BonePart.cpp

示例7: WriteLtx

void Weapon_Statistic::WriteLtx(CInifile& ini, LPCSTR sect)
{
	ini.w_string(sect,"wpn_name",WName.c_str());

	ini.w_string(sect,"wpn_inv_name",InvName.c_str());

	ini.w_u32(sect,"wpn_dwNumBought",NumBought);

	ini.w_u32(sect,"wpn_dwRoundsFired",m_dwRoundsFired);

	ini.w_u32(sect,"wpn_dwBulletsFired",m_dwBulletsFired);

	ini.w_u32(sect,"wpn_dwHitsScored",m_dwHitsScored);

	ini.w_u32(sect,"wpn_dwKillsScored",m_dwKillsScored);

	ini.w_u16(sect,"wpn_dwExplosionKills", m_explosion_kills);

	ini.w_u16(sect,"wpn_dwBleedKills", m_bleed_kills);

	//----------------------------------------------
	u32 NumHits = 0;
	u32 i = 0;
	for (i=0; i<m_Hits.size(); i++)
	{
		HitData& Hit = m_Hits[i];
		if (Hit.Completed && Hit.count) NumHits++;
	};

	ini.w_u32(sect,"NumHits",NumHits);

	u32 hits_size = m_Hits.size();
	i = 0;
	u32 hit_number = 0;
	u8 hit_index = 0;
	while (i < hits_size)
	{
		HitData& Hit		= m_Hits[i];
		if (!Hit.Completed)
		{
			++i;
			hit_index = 0;
			continue;
		}
		
		string512				save_prefix;
		xr_sprintf				(save_prefix,"hit_%d_", hit_number);

		Hit.WriteLtx			(ini, sect, save_prefix);
		
		++hit_index;
		if (hit_index >= Hit.count)
		{
			hit_index = 0;
			++i;
		}
		++hit_number;
	};
};
开发者ID:AntonioModer,项目名称:xray-16,代码行数:59,代码来源:game_cl_base_weapon_usage_statistic_save.cpp

示例8: SaveLTX

void ESceneSpawnTool::SaveLTX(CInifile& ini, int id)
{
	inherited::SaveLTX	(ini, id);

	ini.w_u32		("main", "version", SPAWN_TOOLS_VERSION);

    ini.w_u32		("main", "flags", m_Flags.get());
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:8,代码来源:ESceneSpawnToolsIO.cpp

示例9: SaveLTX

void ESceneSectorTool::SaveLTX(CInifile& ini)
{
	inherited::SaveLTX	(ini);

	ini.w_u32		("main", "version", SECTOR_TOOLS_VERSION);

    ini.w_u32		("main", "flags", m_Flags.get());
}
开发者ID:2asoft,项目名称:xray,代码行数:8,代码来源:ESceneSectorToolsIO.cpp

示例10: SaveLTX

void ESoundEnvironment::SaveLTX(CInifile& ini, LPCSTR sect_name)
{
	inherited::SaveLTX	(ini, sect_name);

	ini.w_u32		(sect_name, "version", SOUND_ENV_VERSION);

    ini.w_string	(sect_name, "env_inner", m_EnvInner.c_str());
    ini.w_string	(sect_name, "env_outer", m_EnvOuter.c_str());
}
开发者ID:2asoft,项目名称:xray,代码行数:9,代码来源:ESound_Environment.cpp

示例11: SFlare

void SThunderboltDesc::create_center_gradient	(CInifile& pIni, shared_str const& sect)
{
	m_GradientCenter			= new SFlare();
    m_GradientCenter->shader 	= pIni.r_string		( sect,"gradient_center_shader" );
    m_GradientCenter->texture	= pIni.r_string		( sect,"gradient_center_texture" );
    m_GradientCenter->fRadius	= pIni.r_fvector2	(sect,"gradient_center_radius"  );
    m_GradientCenter->fOpacity 	= pIni.r_float		( sect,"gradient_center_opacity" );
	m_GradientCenter->m_pFlare->CreateShader		(*m_GradientCenter->shader,*m_GradientCenter->texture);
}
开发者ID:2asoft,项目名称:xray,代码行数:9,代码来源:thunderbolt.cpp

示例12: IsWrite

bool CLog::IsWrite()
{
	CInifile ini;
	ini.ReadInifile( "argument", "Log", "false" );
	std::string contents = ini.GetContents();
	transform( contents.begin(), contents.end(), contents.begin(), ::tolower );

	return !contents.compare( "true" );
}
开发者ID:i-Seiza,项目名称:SoftwareController,代码行数:9,代码来源:Log.cpp

示例13: LoadLTX

//------------------------------------------------------------------------------
bool CGroupObject::LoadLTX(CInifile& ini, LPCSTR sect_name)
{
    u32 version = ini.r_u32(sect_name, "version");
    if (version<0x0011)
    {
        ELog.DlgMsg( mtError, "CGroupObject: unsupported file version. Object can't load.");
        return false;
    }
	CCustomObject::LoadLTX(ini, sect_name);

    Flags32 tmp_flags;tmp_flags.zero();
    if(version<0x0012)
    	tmp_flags.assign(ini.r_u32(sect_name, "flags") );

	// objects
    if(/*IsOpened()*/ tmp_flags.test((1<<0)))
    {    //old opened group save format
        ELog.DlgMsg( mtError, "old opened group save format");
        return false;
/*      
        u32 cnt 	= ini.r_u32			(sect_name, "objects_in_group_count");
        shared_str 		tmp;
    	string128		buff;

        for (u32 k=0; k<cnt; ++k)
        {
			m_ObjectsInGroup.resize				(m_ObjectsInGroup.size()+1);
        	sprintf								(buff,"objects_in_group_%d",k);
        	m_ObjectsInGroup.back().ObjectName	= ini.r_string(sect_name, buff);
        }
*/        
    }else
    {
	    Scene->ReadObjectsLTX			(ini, sect_name, "ingroup", AppendObjectLoadCB, 0);
    }
    VERIFY(m_ObjectsInGroup.size());

   	SetRefName(ini.r_string	(sect_name, "ref_name")) ;
	if (!m_ReferenceName_.size())
        ELog.Msg			(mtError,"ERROR: group '%s' - has empty reference. Corrupted file?", Name);
    

    if(version<0x0012)
    {
        for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it)
            if(it->pObject)
            {
            	it->pObject->m_CO_Flags.set(flObjectInGroup, TRUE);
            	it->pObject->m_CO_Flags.set(flObjectInGroupUnique, TRUE);
            }
    }

    return 			true;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:55,代码来源:GroupObject.cpp

示例14: ReadInifile

///////////////////////////////
// Iniファイルから値を取得する
bool CArgBase::ReadInifile( const _TCHAR *sContents, const _TCHAR *sKey )
{
	m_sReadedIniData = "";

	CInifile ini;
	ini.ReadInifile( sContents, sKey, "" );
	if( strlen( ini.GetContents() )	<= 0 )	return false;

	m_sReadedIniData = ini.GetContents();
	return true;
}
开发者ID:i-Seiza,项目名称:SoftwareController,代码行数:13,代码来源:ArgBase.cpp

示例15:

void CCar::SWheelBreak::Load(LPCSTR section)
{
	CKinematics		*K			=PKinematics(pwheel->car->Visual())												;
	CInifile		*ini		=K->LL_UserData()																;
	VERIFY						(ini)																			;
	break_torque		=		ini->r_float("car_definition","break_torque")									;
	hand_break_torque	=		READ_IF_EXISTS(ini,r_float,"car_definition","hand_break_torque",break_torque)	;
	if(ini->section_exist(section))
	{	
		break_torque					=READ_IF_EXISTS(ini,r_float,section,"break_torque",break_torque);
		hand_break_torque				=READ_IF_EXISTS(ini,r_float,section,"hand_break_torque",hand_break_torque);
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:13,代码来源:CarWheels.cpp


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