mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 16:24:55 +00:00
string_view refactor
This commit is contained in:
@@ -30,7 +30,7 @@ CGuiFrame::~CGuiFrame()
|
||||
x8_guiSys.m_registeredFrames.erase(this);
|
||||
}
|
||||
|
||||
CGuiWidget* CGuiFrame::FindWidget(const std::string& name) const
|
||||
CGuiWidget* CGuiFrame::FindWidget(std::string_view name) const
|
||||
{
|
||||
s16 id = x18_idDB.FindWidgetID(name);
|
||||
if (id == -1)
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
CGuiLight* GetFrameLight(int idx) const { return m_indexedLights[idx]; }
|
||||
CGuiCamera* GetFrameCamera() const { return x14_camera.get(); }
|
||||
CGuiWidget* FindWidget(const std::string& name) const;
|
||||
CGuiWidget* FindWidget(std::string_view name) const;
|
||||
CGuiWidget* FindWidget(s16 id) const;
|
||||
void SetFrameCamera(std::shared_ptr<CGuiCamera>&& camr) { x14_camera = std::move(camr); }
|
||||
void SetHeadWidget(std::shared_ptr<CGuiHeadWidget>&& hwig) { xc_headWidget = std::move(hwig); }
|
||||
|
||||
@@ -230,7 +230,7 @@ void CGuiTextSupport::SetFontColor(const zeus::CColor& col)
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiTextSupport::AddText(const std::u16string& str)
|
||||
void CGuiTextSupport::AddText(std::u16string_view str)
|
||||
{
|
||||
if (x60_renderBuf)
|
||||
{
|
||||
@@ -242,7 +242,7 @@ void CGuiTextSupport::AddText(const std::u16string& str)
|
||||
ClearRenderBuffer();
|
||||
}
|
||||
|
||||
void CGuiTextSupport::SetText(const std::u16string& str, bool multipage)
|
||||
void CGuiTextSupport::SetText(std::u16string_view str, bool multipage)
|
||||
{
|
||||
if (x0_string.compare(str))
|
||||
{
|
||||
@@ -255,7 +255,7 @@ void CGuiTextSupport::SetText(const std::u16string& str, bool multipage)
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiTextSupport::SetText(const std::string& str, bool multipage)
|
||||
void CGuiTextSupport::SetText(std::string_view str, bool multipage)
|
||||
{
|
||||
SetText(hecl::UTF8ToChar16(str), multipage);
|
||||
}
|
||||
|
||||
@@ -129,16 +129,16 @@ public:
|
||||
void SetGeometryColor(const zeus::CColor& col);
|
||||
void SetOutlineColor(const zeus::CColor& col);
|
||||
void SetFontColor(const zeus::CColor& col);
|
||||
void AddText(const std::u16string& str);
|
||||
void SetText(const std::u16string& str, bool multipage=false);
|
||||
void SetText(const std::string& str, bool multipage=false);
|
||||
void AddText(std::u16string_view str);
|
||||
void SetText(std::u16string_view str, bool multipage=false);
|
||||
void SetText(std::string_view str, bool multipage=false);
|
||||
void SetJustification(EJustification j);
|
||||
void SetVerticalJustification(EVerticalJustification j);
|
||||
void SetImageBaseline(bool b);
|
||||
bool GetIsTextSupportFinishedLoading() const;
|
||||
float GetCurTime() const { return x3c_curTime; }
|
||||
void SetCurTime(float t) { x3c_curTime = t; }
|
||||
const std::u16string& GetString() const { return x0_string; }
|
||||
std::u16string_view GetString() const { return x0_string; }
|
||||
void SetControlTXTRMap(const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
|
||||
int GetPageCounter() const { return x304_pageCounter; }
|
||||
int GetTotalPageCount();
|
||||
|
||||
@@ -11,15 +11,15 @@ CGuiWidgetIdDB::CGuiWidgetIdDB()
|
||||
AddWidget("kGSYS_DefaultLightID");
|
||||
}
|
||||
|
||||
s16 CGuiWidgetIdDB::FindWidgetID(const std::string& name) const
|
||||
s16 CGuiWidgetIdDB::FindWidgetID(std::string_view name) const
|
||||
{
|
||||
auto search = x0_dbMap.find(name);
|
||||
auto search = x0_dbMap.find(name.data());
|
||||
if (search == x0_dbMap.cend())
|
||||
return -1;
|
||||
return search->second;
|
||||
}
|
||||
|
||||
s16 CGuiWidgetIdDB::AddWidget(const std::string& name, s16 id)
|
||||
s16 CGuiWidgetIdDB::AddWidget(std::string_view name, s16 id)
|
||||
{
|
||||
s16 findId = FindWidgetID(name);
|
||||
if (findId == -1)
|
||||
@@ -32,7 +32,7 @@ s16 CGuiWidgetIdDB::AddWidget(const std::string& name, s16 id)
|
||||
return findId;
|
||||
}
|
||||
|
||||
s16 CGuiWidgetIdDB::AddWidget(const std::string& name)
|
||||
s16 CGuiWidgetIdDB::AddWidget(std::string_view name)
|
||||
{
|
||||
s16 findId = FindWidgetID(name);
|
||||
if (findId == -1)
|
||||
|
||||
@@ -13,9 +13,9 @@ class CGuiWidgetIdDB
|
||||
s16 x14_lastPoolId = 0;
|
||||
public:
|
||||
CGuiWidgetIdDB();
|
||||
s16 FindWidgetID(const std::string& name) const;
|
||||
s16 AddWidget(const std::string& name, s16 id);
|
||||
s16 AddWidget(const std::string& name);
|
||||
s16 FindWidgetID(std::string_view name) const;
|
||||
s16 AddWidget(std::string_view name, s16 id);
|
||||
s16 AddWidget(std::string_view name);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void CHudBossEnergyInterface::Update(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
void CHudBossEnergyInterface::SetBossParams(bool visible, const std::u16string& name,
|
||||
void CHudBossEnergyInterface::SetBossParams(bool visible, std::u16string_view name,
|
||||
float curEnergy, float maxEnergy)
|
||||
{
|
||||
x10_24_visible = visible;
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
CHudBossEnergyInterface(CGuiFrame& selHud);
|
||||
void Update(float dt);
|
||||
void SetAlpha(float a) { x0_alpha = a; }
|
||||
void SetBossParams(bool visible, const std::u16string& name,
|
||||
void SetBossParams(bool visible, std::u16string_view name,
|
||||
float curEnergy, float maxEnergy);
|
||||
static std::pair<zeus::CVector3f, zeus::CVector3f> BossEnergyCoordFunc(float t);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user