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

C++ shared_str类代码示例

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

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



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

示例1:

void PDomain::Save2(CInifile& ini, const shared_str& sect)
{
	ini.w_u32		(sect.c_str(), "type", type);
	ini.w_fvector3	(sect.c_str(), "v0", v[0]);
	ini.w_fvector3	(sect.c_str(), "v1", v[1]);
	ini.w_fvector3	(sect.c_str(), "v2", v[2]);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:7,代码来源:pDomain.cpp


示例2:

BOOL is_combat_cover			(shared_str const &table_id)
{
	if (table_id.size() == 0)
		return					(FALSE);

	string256					temp;
	xr_strcpy					(temp, "smart_covers.descriptions.");
	xr_strcat					(temp, *table_id);

	luabind::object				table, value;
	bool						result = 
		ai().script_engine().function_object(
		temp,
		table,
		LUA_TTABLE
		);

	VERIFY2						(result, make_string("bad or missing description in smart_cover [%s]", table_id.c_str()));
	if (table.type() != LUA_TTABLE) {
		VERIFY					(table.type() != LUA_TNIL);
		return					(TRUE);
	}

	value						= table["is_combat_cover"];
	if (value.type() == LUA_TNIL) {
		Msg						("! is_combat_cover flag not found for smart_cover [%s], forcing to \"true\"", table_id.c_str());
		return					(TRUE);
	}

	return						(parse_bool(table, "is_combat_cover") ? TRUE : FALSE);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:31,代码来源:xrServer_Objects_Alife_Smartcovers.cpp


示例3: AnsiString

bool PS::CPEDef::OnAfterActionNameEdit(PropValue* sender, shared_str& edit_val)
{
	bool found				= false;
	edit_val				= AnsiString(edit_val.c_str()).LowerCase().c_str();
    FindActionByName		(edit_val.c_str(),found); 
    return 					!found;
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:ParticleEffectEditor.cpp


示例4:

shared_str manager::unique_id	(shared_str const& id) const
{
	if (m_collection->unique_id(id.c_str()))
		return				(id);

	return					(m_collection->generate_unique_id(id.c_str()));
}
开发者ID:2asoft,项目名称:xray,代码行数:7,代码来源:editor_environment_ambients_manager.cpp


示例5: GetRestr

void CRestrictions::AddRestriction4rank(u32 rank, const shared_str& lst)
{// private
	VERIFY					(m_bInited);

	rank_rest_vec& rest		= m_restrictions[rank];
	
	if(rank!=_RANK_COUNT)
	{
		u32 src_idx			= (rank==0)?_RANK_COUNT:(rank-1);
		rest				= m_restrictions[ src_idx ];
	}

	string256				singleItem;
	u32 count				= _GetItemCount(lst.c_str());
	for (u32 j = 0; j < count; ++j)
	{
		_GetItem			(lst.c_str(), j, singleItem);
		RESTR r				= GetRestr(singleItem);
		restr_item* ritem	= find_restr_item_internal(rank, r.name);
		VERIFY2				((ritem || rank==_RANK_COUNT), singleItem);
		if(!ritem)
			rest.push_back	(mk_pair(r.name, r.n));
		else
			ritem->second	= r.n;
	}
}
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:26,代码来源:Restrictions.cpp


示例6:

void	CUIBagWnd::ReloadItemsPrices	()
{
	string256 ItemCostStr	= "";
	string256 RankStr		= "";

	u32 sz = m_allItems.size();

	for (u32 i = 0; i<sz; i++)
	{
		CUICellItem* itm				= m_allItems[i];
		CInventoryItem* iitm			= (CInventoryItem*)itm->m_pData;
		const shared_str itm_name		= iitm->object().cNameSect();

		m_info[itm->m_index].price		= pSettings->r_u32(m_sectionPrice, *itm_name);

		strconcat						(sizeof(ItemCostStr),ItemCostStr, itm_name.c_str(), "_cost");
		if (pSettings->line_exist		(m_sectionPrice, ItemCostStr))
			m_info[itm->m_index].price	= pSettings->r_u32(m_sectionPrice, ItemCostStr);


		for (u32 i=1; i<=g_mp_restrictions.GetRank(); ++i)
		{
			sprintf_s						(RankStr, "rank_%d", i);
			if (!pSettings->line_exist	(RankStr, ItemCostStr))	continue;
			m_info[itm->m_index].price	= pSettings->r_u32(RankStr, ItemCostStr);
		}
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:28,代码来源:UIBagWnd.cpp


示例7: SetWeather

void CEnvironment::SetWeather(shared_str name, bool forced)
{
//.	static BOOL bAlready = FALSE;
//.	if(bAlready)	return;
	if (name.size())	{
//.		bAlready = TRUE;
        EnvsMapIt it		= WeatherCycles.find(name);
		if (it == WeatherCycles.end())
		{
			Msg("! Invalid weather name: %s", name.c_str());
			return;
		}
        R_ASSERT3			(it!=WeatherCycles.end(),"Invalid weather name.",*name);
		CurrentCycleName	= it->first;
		if (forced)			{Invalidate();			}
		if (!bWFX){
			CurrentWeather		= &it->second;
			CurrentWeatherName	= it->first;
		}
		if (forced)			{SelectEnvs(fGameTime);	}
#ifdef WEATHER_LOGGING
		Msg					("Starting Cycle: %s [%s]",*name,forced?"forced":"deferred");
#endif
    }else{
#ifndef _EDITOR
		FATAL				("! Empty weather name");
#endif
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:29,代码来源:Environment.cpp


示例8: AddQuestion

void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value)
{
	if(text.size() == 0)
	{
		return;
	}
	UITalkDialogWnd->AddQuestion(*CStringTable().translate(text),value.c_str());
}
开发者ID:2asoft,项目名称:xray,代码行数:8,代码来源:UITalkWnd.cpp


示例9: AddAnswer

void CUITalkWnd::AddAnswer(const shared_str& text, LPCSTR SpeakerName)
{
	//для пустой фразы вообще ничего не выводим
	if(text.size() == 0) return;
	PlaySnd			(text.c_str());

	bool i_am = (0 == xr_strcmp(SpeakerName, m_pOurInvOwner->Name()));
	UITalkDialogWnd->AddAnswer(SpeakerName,*CStringTable().translate(text),i_am);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:9,代码来源:UITalkWnd.cpp


示例10: motion_length

u32 player_hud::motion_length(const shared_str& anim_name, const shared_str& hud_name, const CMotionDef*& md)
{
	float speed						= CalcMotionSpeed(anim_name);
	attachable_hud_item* pi			= create_hud_item(hud_name);
	player_hud_motion*	pm			= pi->m_hand_motions.find_motion(anim_name);
	if(!pm)
		return						100; // ms TEMPORARY
	R_ASSERT2						(pm, 
		make_string	("hudItem model [%s] has no motion with alias [%s]", hud_name.c_str(), anim_name.c_str() ).c_str() 
		);
	return motion_length			(pm->m_animations[0].mid, md, speed);
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:12,代码来源:player_hud.cpp


示例11:

void CRestrictedObject::remove_restrictions	(const shared_str &out_restrictions, const shared_str &in_restrictions)
{
	if (!out_restrictions.size() && !in_restrictions.size())
		return;

	START_PROFILE("Restricted Object/Remove Restrictions");
	
	Level().space_restriction_manager().remove_restrictions	(object().ID(),*out_restrictions,*in_restrictions);
	
	actual						(false);

	STOP_PROFILE;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:13,代码来源:restricted_object.cpp


示例12: GetFieldValue

s32 UITeamState::GetFieldValue(shared_str const & field_name) const
{
	if (field_name.equal("mp_artefacts_upcase"))
	{
		return m_artefact_count;
	} else if (field_name.equal("mp_players"))
	{
		return static_cast<s32>(myPlayers.size());
	} else if (field_name.equal("mp_frags_upcase"))
	{

		return GetSummaryFrags();
	}
	return -1;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:15,代码来源:UITeamState.cpp


示例13:

shared_str weather::generate_unique_id	(shared_str const& start) const
{
	string16			id;
	strcpy_s			(id, start.c_str());

	VERIFY				(xr_strlen(id) == 8);
	VERIFY				(is_digit(id[0]));
	VERIFY				(is_digit(id[1]));
	VERIFY				(id[2] == ':');
	VERIFY				(is_digit(id[3]));
	VERIFY				(is_digit(id[4]));
	VERIFY				(id[5] == ':');
	VERIFY				(is_digit(id[6]));
	VERIFY				(is_digit(id[7]));

	u32					hours, minutes, seconds;
	sscanf_s			(id, "%02d:%02d:%02d", &hours, &minutes, &seconds);

	shared_str			result;

	if (try_hours(hours, minutes, seconds, result))
		return			(result);

	if (try_minutes(hours, minutes, seconds, result))
		return			(result);

	return				(try_all(hours, minutes, seconds));
}
开发者ID:2asoft,项目名称:xray,代码行数:28,代码来源:editor_environment_weathers_weather.cpp


示例14:

bool __stdcall PS::CPEDef::NameOnAfterEdit(PropValue* sender, shared_str& edit_val)
{
    for (PS::PGDIt g_it= ::Render->PSLibrary.FirstPGD(); g_it!=::Render->PSLibrary.LastPGD(); ++g_it)
    {
    	PS::CPGDef*	pg 	= (*g_it);
        xr_vector<PS::CPGDef::SEffect*>::const_iterator pe_it 		= pg->m_Effects.begin();
        xr_vector<PS::CPGDef::SEffect*>::const_iterator pe_it_e 	= pg->m_Effects.end();

        for(;pe_it!=pe_it_e;++pe_it)
        {
        	PS::CPGDef::SEffect* Eff		= (*pe_it);
			if(Eff->m_EffectName == this->m_Name)
               Eff->m_EffectName = edit_val;

			if(Eff->m_OnPlayChildName == this->m_Name)
            	Eff->m_OnPlayChildName = edit_val;

			if(Eff->m_OnBirthChildName == this->m_Name)
            	Eff->m_OnBirthChildName = edit_val;

			if(Eff->m_OnDeadChildName == this->m_Name)
            	Eff->m_OnDeadChildName = edit_val;
        }
    }
    _item_to_select_after_edit = edit_val.c_str();
    return true;
}
开发者ID:2asoft,项目名称:xray,代码行数:27,代码来源:ParticleEffectEditor.cpp


示例15:

void CObject::cNameVisual_set	(shared_str N)
{ 
	// check if equal
	if (*N && *NameVisual)
		if (N==NameVisual)		return;

	// replace model
	if (*N && N[0]) 
	{
		IRender_Visual			*old_v = renderable.visual;
		
#ifdef DEBUG
		if(NameVisual.size())
			Msg("---change NameVisual from[%s] to [%s]",NameVisual.c_str(), N.c_str());
#endif // DEBUG

		NameVisual				= N;
		renderable.visual		= Render->model_Create	(*N);
		
		CKinematics* old_k	= old_v?old_v->dcast_PKinematics():NULL;
		CKinematics* new_k	= renderable.visual->dcast_PKinematics();

		if(old_k && new_k){
			new_k->Update_Callback			= old_k->Update_Callback;
			new_k->Update_Callback_Param	= old_k->Update_Callback_Param;
		}
		::Render->model_Delete	(old_v);
	} else {
		::Render->model_Delete	(renderable.visual);
		NameVisual				= 0;
	}
	OnChangeVisual				();
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:33,代码来源:xr_object.cpp


示例16: SetAmmoIcon

void CUIHudStatesWnd::SetAmmoIcon(const shared_str& sect_name)
{
	if (!sect_name.size())
	{
		m_ui_weapon_icon->Show(false);
		return;
	}
	m_ui_weapon_icon->Show(true);

	Frect texture_rect;
	texture_rect.x1					= pSettings->r_float(sect_name,  "inv_grid_x")		*INV_GRID_WIDTH;
	texture_rect.y1					= pSettings->r_float(sect_name,  "inv_grid_y")		*INV_GRID_HEIGHT;
	texture_rect.x2					= pSettings->r_float( sect_name, "inv_grid_width")	*INV_GRID_WIDTH;
	texture_rect.y2					= pSettings->r_float( sect_name, "inv_grid_height")	*INV_GRID_HEIGHT;
	texture_rect.rb.add				(texture_rect.lt);
	m_ui_weapon_icon->GetUIStaticItem().SetTextureRect(texture_rect);
	m_ui_weapon_icon->SetStretchTexture(true);

	float h = texture_rect.height() * 0.8f;
	float w = texture_rect.width() * 0.8f;

// now perform only width scale for ammo, which (W)size >2
	if (texture_rect.width() > 2.01f*INV_GRID_WIDTH)
		w = INV_GRID_WIDTH * 1.5f;

	m_ui_weapon_icon->SetWidth( w*UI().get_current_kx() );
	m_ui_weapon_icon->SetHeight( h );
}
开发者ID:zcaliptium,项目名称:xray-16,代码行数:28,代码来源:UIHudStatesWnd.cpp


示例17: AddQuestion

void CUITalkWnd::AddQuestion(const shared_str& text, const shared_str& value
#ifdef NUM_PHRASES
, int number
#endif
)
{
	if(text.size() == 0)
	{
		return;
	}
	UITalkDialogWnd->AddQuestion(*CStringTable().translate(text),value.c_str()
#ifdef NUM_PHRASES
, number
#endif
);
}
开发者ID:Charsi82,项目名称:xray-1.5.10-2015-,代码行数:16,代码来源:UITalkWnd.cpp


示例18: GetIconParamValue

void UIPlayerItem::GetIconParamValue(game_PlayerState const * ps,
									 shared_str const & param_name,
									 buffer_vector<char> & dest)
{
	VERIFY(ps);
	game_cl_mp* cl_game = static_cast<game_cl_mp*>(&Game());
	VERIFY(cl_game);
	if (param_name.equal("rank"))
	{
		if (ETeam(cl_game->ModifyTeam(ps->team)) == etGreenTeam)
		{
			sprintf_s(dest.begin(), dest.size(), "ui_hud_status_green_0%d", ps->rank + 1);
		} else if (ETeam(cl_game->ModifyTeam(ps->team)) == etBlueTeam)
		{
			sprintf_s(dest.begin(), dest.size(), "ui_hud_status_blue_0%d", ps->rank + 1);
		}
	} else if (param_name.equal("death_atf"))
	{
		if (ps->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
		{
			strcpy_s(dest.begin(), dest.size(), "death");
			return;
		}
		if (cl_game->Type() == eGameIDCaptureTheArtefact)
		{
			game_cl_CaptureTheArtefact* cta_cl_game = static_cast<game_cl_CaptureTheArtefact*>(cl_game);
			R_ASSERT(cta_cl_game);
			if (ps->GameID == cta_cl_game->GetGreenArtefactOwnerID() ||
				ps->GameID == cta_cl_game->GetBlueArtefactOwnerID())
			{
				strcpy_s(dest.begin(), dest.size(), "artefact");
			}
		} else if (cl_game->Type() == eGameIDArtefactHunt)
		{
			game_cl_ArtefactHunt* ahunt_cl_game = static_cast<game_cl_ArtefactHunt*>(cl_game);
			R_ASSERT(ahunt_cl_game);
			if (ps->GameID == ahunt_cl_game->artefactBearerID)
			{
				strcpy_s(dest.begin(), dest.size(), "artefact");
			}
		}
	} else
	{
		VERIFY2(false, make_string("unknown icon parameter: %s", param_name.c_str()).c_str());
	}

}
开发者ID:2asoft,项目名称:xray,代码行数:47,代码来源:UIPlayerItem.cpp


示例19: FillPointsDetail

void CUIActorInfoWnd::FillPointsDetail(const shared_str& id)
{

	UIDetailList->Clear							();
	CUIXml										uiXml;
	uiXml.Load									(CONFIG_PATH, UI_PATH,ACTOR_STATISTIC_XML);
	uiXml.SetLocalRoot							(uiXml.NavigateToNode("actor_stats_wnd",0));
	
	string512 path;
	sprintf_s									(path,"detail_part_%s",id.c_str());
	
	XML_NODE* n									= uiXml.NavigateToNode(path,0);
	if(!n)
		sprintf_s								(path,"detail_part_def");

#pragma todo("implement this")
/*
	string256									str;
	sprintf_s									(str,"st_detail_list_for_%s", id.c_str());
	UIInfoHeader->GetTitleStatic()->SetTextST	(str);
*/
	SStatSectionData&	section				= Actor()->	StatisticMgr().GetSection(id);
	vStatDetailData::const_iterator it		= section.data.begin();
	vStatDetailData::const_iterator it_e	= section.data.end();

	int _cntr = 0;
	string64 buff;
	for(;it!=it_e;++it,++_cntr)
	{
		CUIActorStaticticDetail* itm		= xr_new<CUIActorStaticticDetail>();
		itm->Init							(&uiXml, path, 0);

		sprintf_s							(buff,"%d.",_cntr);
		itm->m_text0->SetText				(buff);

		itm->m_text1->SetTextST				(*CStringTable().translate((*it).key));
		itm->m_text1->AdjustHeightToText	();

		if( 0==(*it).str_value.size() )
		{
			sprintf_s							(buff,"x%d", (*it).int_count);
			itm->m_text2->SetTextST				(buff);

			sprintf_s							(buff,"%d", (*it).int_points);
			itm->m_text3->SetTextST				(buff);
		}else
		{
			itm->m_text2->SetTextST				((*it).str_value.c_str());
			itm->m_text3->SetTextST				("");
		}

		Fvector2 sz							= itm->GetWndSize();
		float _height;
		_height								= _max(sz.y, itm->m_text1->GetWndPos().y+itm->m_text1->GetWndSize().y+3);
		sz.y								= _height;
		itm->SetWndSize						(sz);
		UIDetailList->AddWindow				(itm, true);
	}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:59,代码来源:UIActorInfo.cpp


示例20: GetTextParamValue

void UIPlayerItem::GetTextParamValue(game_PlayerState const * ps, 
									 shared_str const & param_name,
									 buffer_vector<char> & dest)
{
	VERIFY(ps);
	if (param_name.equal("mp_name"))
	{
		strcpy_s(dest.begin(), dest.size(), ps->name);
	} else if (param_name.equal("mp_frags"))
	{
		sprintf_s(dest.begin(), dest.size(), "%d", ps->m_iRivalKills - ps->m_iSelfKills);
	} else if (param_name.equal("mp_deaths"))
	{
		sprintf_s(dest.begin(), dest.size(), "%d", ps->m_iDeaths);
	} else if (param_name.equal("mp_artefacts"))
	{
		sprintf_s(dest.begin(), dest.size(), "%d", ps->af_count);
	} else if (param_name.equal("mp_spots"))
	{
		sprintf_s(dest.begin(), dest.size(), "%d", m_checkPoints);
	}else if (param_name.equal("mp_status"))
	{
		CStringTable st;
		if (ps->testFlag(GAME_PLAYER_FLAG_READY))
			strcpy_s(dest.begin(), dest.size(), st.translate("st_mp_ready").c_str());
	} else if (param_name.equal("mp_ping"))
	{
		sprintf_s(dest.begin(), dest.size(), "%d", ps->ping);
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:30,代码来源:UIPlayerItem.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ship类代码示例发布时间:2022-05-31
下一篇:
C++ shared_ptr类代码示例发布时间: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