本文整理汇总了C++中shared_str类的典型用法代码示例。如果您正苦于以下问题:C++ shared_str类的具体用法?C++ shared_str怎么用?C++ shared_str使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了shared_str类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}
示例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);
}
示例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;
}
示例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()));
}
示例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;
}
}
示例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);
}
}
}
示例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
}
}
示例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());
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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 ();
}