1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-30 00:06:39 +00:00

Make Normalized constructor from const char* explicit

This commit is contained in:
elsid 2024-02-22 23:59:23 +01:00
parent 595e42ae43
commit 92d57d6e46
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
4 changed files with 15 additions and 1 deletions

View file

@ -2,6 +2,7 @@
#define TESTING_UTIL_H
#include <filesystem>
#include <initializer_list>
#include <sstream>
#include <components/misc/strings/conversion.hpp>
@ -73,6 +74,12 @@ namespace TestingOpenMW
return vfs;
}
inline std::unique_ptr<VFS::Manager> createTestVFS(
std::initializer_list<std::pair<VFS::Path::NormalizedView, VFS::File*>> files)
{
return createTestVFS(VFS::FileMap(files.begin(), files.end()));
}
#define EXPECT_ERROR(X, ERR_SUBSTR) \
try \
{ \

View file

@ -57,6 +57,11 @@ namespace VFS
return mIndex.find(name) != mIndex.end();
}
bool Manager::exists(Path::NormalizedView name) const
{
return mIndex.find(name) != mIndex.end();
}
std::string Manager::getArchive(const Path::Normalized& name) const
{
for (auto it = mArchives.rbegin(); it != mArchives.rend(); ++it)

View file

@ -43,6 +43,8 @@ namespace VFS
/// @note May be called from any thread once the index has been built.
bool exists(const Path::Normalized& name) const;
bool exists(Path::NormalizedView name) const;
/// Retrieve a file by name.
/// @note Throws an exception if the file can not be found.
/// @note May be called from any thread once the index has been built.

View file

@ -122,7 +122,7 @@ namespace VFS::Path
{
}
Normalized(const char* value)
explicit Normalized(const char* value)
: Normalized(std::string_view(value))
{
}