Skip to content

Commit

Permalink
[共通] preloadText を StringView に #1158
Browse files Browse the repository at this point in the history
  • Loading branch information
Reputeless committed Dec 10, 2023
1 parent 01af2c4 commit d1c8358
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Siv3D/include/Siv3D/FontAsset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace s3d
[[nodiscard]]
static bool IsRegistered(AssetNameView name);

static bool Load(AssetNameView name, const String& preloadText = U"");
static bool Load(AssetNameView name, StringView preloadText = U"");

static void LoadAsync(AssetNameView name, const String& preloadText = U"");
static void LoadAsync(AssetNameView name, StringView preloadText = U"");

/// @brief 指定したフォントアセットのロードが完了するまで待機します。
/// @param name フォントアセット名
Expand Down
8 changes: 4 additions & 4 deletions Siv3D/src/Siv3D/Asset/CAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace s3d
return m_assetLists[FromEnum(assetType)].contains(name);
}

bool CAsset::load(const AssetType assetType, const AssetNameView name, const String& hint)
bool CAsset::load(const AssetType assetType, const AssetNameView name, const StringView hint)
{
auto& assetList = m_assetLists[FromEnum(assetType)];
const auto it = assetList.find(name);
Expand All @@ -124,10 +124,10 @@ namespace s3d
return false;
}

return it->second->load(hint);
return it->second->load(String{ hint });
}

void CAsset::loadAsync(const AssetType assetType, const AssetNameView name, const String& hint)
void CAsset::loadAsync(const AssetType assetType, const AssetNameView name, const StringView hint)
{
auto& assetList = m_assetLists[FromEnum(assetType)];
const auto it = assetList.find(name);
Expand All @@ -138,7 +138,7 @@ namespace s3d
return;
}

it->second->loadAsync(hint);
it->second->loadAsync(String{ hint });
}

void CAsset::wait(const AssetType assetType, const AssetNameView name)
Expand Down
4 changes: 2 additions & 2 deletions Siv3D/src/Siv3D/Asset/CAsset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ namespace s3d

bool isRegistered(AssetType assetType, AssetNameView name) const override;

bool load(AssetType assetType, AssetNameView name, const String& hint) override;
bool load(AssetType assetType, AssetNameView name, StringView hint) override;

void loadAsync(AssetType assetType, AssetNameView name, const String& hint) override;
void loadAsync(AssetType assetType, AssetNameView name, StringView hint) override;

void wait(AssetType assetType, AssetNameView name) override;

Expand Down
4 changes: 2 additions & 2 deletions Siv3D/src/Siv3D/Asset/IAsset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ namespace s3d

virtual bool isRegistered(AssetType assetType, AssetNameView name) const = 0;

virtual bool load(AssetType assetType, AssetNameView name, const String& hint) = 0;
virtual bool load(AssetType assetType, AssetNameView name, StringView hint) = 0;

virtual void loadAsync(AssetType assetType, AssetNameView name, const String& hint) = 0;
virtual void loadAsync(AssetType assetType, AssetNameView name, StringView hint) = 0;

virtual void wait(AssetType assetType, AssetNameView name) = 0;

Expand Down
4 changes: 2 additions & 2 deletions Siv3D/src/Siv3D/FontAsset/SivFontAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ namespace s3d
return SIV3D_ENGINE(Asset)->isRegistered(AssetType::Font, name);
}

bool FontAsset::Load(const AssetNameView name, const String& preloadText)
bool FontAsset::Load(const AssetNameView name, const StringView preloadText)
{
return SIV3D_ENGINE(Asset)->load(AssetType::Font, name, preloadText);
}

void FontAsset::LoadAsync(const AssetNameView name, const String& preloadText)
void FontAsset::LoadAsync(const AssetNameView name, const StringView preloadText)
{
SIV3D_ENGINE(Asset)->loadAsync(AssetType::Font, name, preloadText);
}
Expand Down

0 comments on commit d1c8358

Please sign in to comment.