diff --git a/Siv3D/include/Siv3D/FontAsset.hpp b/Siv3D/include/Siv3D/FontAsset.hpp index 092e2a0d8..468018d0a 100644 --- a/Siv3D/include/Siv3D/FontAsset.hpp +++ b/Siv3D/include/Siv3D/FontAsset.hpp @@ -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 フォントアセット名 diff --git a/Siv3D/src/Siv3D/Asset/CAsset.cpp b/Siv3D/src/Siv3D/Asset/CAsset.cpp index fa9162f75..7c1a0f089 100644 --- a/Siv3D/src/Siv3D/Asset/CAsset.cpp +++ b/Siv3D/src/Siv3D/Asset/CAsset.cpp @@ -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); @@ -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); @@ -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) diff --git a/Siv3D/src/Siv3D/Asset/CAsset.hpp b/Siv3D/src/Siv3D/Asset/CAsset.hpp index 164a6139b..43cdd396e 100644 --- a/Siv3D/src/Siv3D/Asset/CAsset.hpp +++ b/Siv3D/src/Siv3D/Asset/CAsset.hpp @@ -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; diff --git a/Siv3D/src/Siv3D/Asset/IAsset.hpp b/Siv3D/src/Siv3D/Asset/IAsset.hpp index 469541ea3..21ee902a2 100644 --- a/Siv3D/src/Siv3D/Asset/IAsset.hpp +++ b/Siv3D/src/Siv3D/Asset/IAsset.hpp @@ -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; diff --git a/Siv3D/src/Siv3D/FontAsset/SivFontAsset.cpp b/Siv3D/src/Siv3D/FontAsset/SivFontAsset.cpp index 9bf282e49..9a285d356 100644 --- a/Siv3D/src/Siv3D/FontAsset/SivFontAsset.cpp +++ b/Siv3D/src/Siv3D/FontAsset/SivFontAsset.cpp @@ -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); }