blob: d6076d090a3366f4cf6e515bb115c43a96ca0a1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "impl.hpp"
namespace floormat {
using loader_detail::loader_impl;
void loader_::destroy()
{
loader.~loader_();
new (&loader) loader_impl();
}
loader_& loader_::default_loader() noexcept
{
static loader_impl loader_singleton{};
return loader_singleton;
}
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
loader_& loader = loader_::default_loader();
loader_::loader_() = default;
loader_::~loader_() = default;
StringView loader_::strip_prefix(StringView name)
{
if (name.hasPrefix(IMAGE_PATH))
return name.exceptPrefix(IMAGE_PATH.size());
if (name.hasPrefix(ANIM_PATH))
return name.exceptPrefix(ANIM_PATH.size());
if (name.hasPrefix(SCENERY_PATH))
return name.exceptPrefix(SCENERY_PATH.size());
if (name.hasPrefix(VOBJ_PATH))
return name.exceptPrefix(VOBJ_PATH.size());
return name;
}
const StringView loader_::IMAGE_PATH = "images/"_s;
const StringView loader_::ANIM_PATH = "anim/"_s;
const StringView loader_::SCENERY_PATH = "scenery/"_s;
const StringView loader_::TEMP_PATH = "../../../"_s;
const StringView loader_::VOBJ_PATH = "vobj/"_s;
} // namespace floormat
|