Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
ResourcePath.cpp
Go to the documentation of this file.
1
2
5
6namespace Divide {
7
8size_t ResourcePath::length() const noexcept
9{
10 return _fileSystemPath.string().length();
11}
12
13bool ResourcePath::empty() const noexcept
14{
15 return _fileSystemPath.empty();
16}
17
18ResourcePath& ResourcePath::append(const std::string_view str)
19{
20 _fileSystemPath = std::filesystem::path( string().append(str) );
21 return *this;
22}
23
25{
26 _fileSystemPath = std::filesystem::relative( _fileSystemPath, base._fileSystemPath );
27 return *this;
28}
29
31{
32 ResourcePath ret = *this;
33 return ret.makeRelative(base);
34}
35
37{
38 return ResourcePath { (lhs.fileSystemPath() / rhs.fileSystemPath()).string() };
39}
40
42{
43 lhs = lhs / rhs;
44 return lhs;
45}
46
47ResourcePath operator/ ( const ResourcePath& lhs, const std::string_view rhs )
48{
49 return ResourcePath{ (lhs.fileSystemPath() / rhs).string() };
50}
51
52ResourcePath& operator/=( ResourcePath& lhs, const std::string_view rhs )
53{
54 lhs = lhs / rhs;
55 return lhs;
56}
57
58bool operator== (const ResourcePath& lhs, std::string_view rhs)
59{
60 return lhs == ResourcePath(rhs);
61}
62
63bool operator!= (const ResourcePath& lhs, std::string_view rhs)
64{
65 return lhs != ResourcePath(rhs);
66}
67
68bool operator== (const ResourcePath& lhs, const ResourcePath& rhs)
69{
70 return lhs.fileSystemPath().lexically_normal().compare(rhs.fileSystemPath().lexically_normal()) == 0;
71}
72
73bool operator!= (const ResourcePath& lhs, const ResourcePath& rhs)
74{
75 return lhs.fileSystemPath().lexically_normal().compare( rhs.fileSystemPath().lexically_normal() ) != 0;
76}
77
78bool operator==( const FileNameAndPath& lhs, const FileNameAndPath& rhs )
79{
80 return lhs._fileName == rhs._fileName &&
81 lhs._path == rhs._path;
82}
83
84bool operator!=( const FileNameAndPath& lhs, const FileNameAndPath& rhs )
85{
86 return lhs._fileName != rhs._fileName ||
87 lhs._path != rhs._path;
88}
89
90}; //namespace Divide
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
FORCE_INLINE bool operator!=(const GUIDWrapper &lhs, const GUIDWrapper &rhs) noexcept
Definition: GUIDWrapper.h:67
ResourcePath operator/(const ResourcePath &lhs, const ResourcePath &rhs)
ResourcePath & operator/=(ResourcePath &lhs, const ResourcePath &rhs)
bool operator==(const DisplayManager::OutputDisplayProperties &lhs, const DisplayManager::OutputDisplayProperties &rhs) noexcept
Definition: Application.inl:37
bool empty() const noexcept
size_t length() const noexcept
Definition: ResourcePath.cpp:8
ResourcePath & append(std::string_view str)
ResourcePath & makeRelative(const ResourcePath &base)
ResourcePath getRelative(const ResourcePath &base) const