resonance 1.0.1
Loading...
Searching...
No Matches
filepath.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/hxstr.h"
4
5namespace Rnd {
6class Dbg;
7class Stream;
8} // namespace Rnd
9
10namespace Rnd {
11
24class FilePath : public HxStr {
25public:
28 }
29
35 explicit FilePath(const char *pszText) : HxStr(pszText) {
36 }
37
48 void SetFromRoot(const HxStr &name);
49
57 void Set(const HxStr &path);
58
70 void Normalize();
71
84 const HxStr &RelativeToRoot() const;
85
93 void Print(Dbg &sink) const;
94
102 void Save(Stream &stream) const;
103
111 void Load(Stream &stream);
112
123 static void SetRoot(const HxStr &root);
124
137 static bool IsAbsolute(const HxStr &path);
138
148};
149
150} // namespace Rnd
HxStr()
Construct an empty string.
Definition hxstr.h:55
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
FilePath(const char *pszText)
Construct a path from text without normalising it.
Definition filepath.h:35
void Save(Stream &stream) const
Write the path relative to sRoot, with its terminator, to stream.
void SetFromRoot(const HxStr &name)
Set the path to name under sRoot.
void Set(const HxStr &path)
Set the path to path verbatim, then normalise it.
const HxStr & RelativeToRoot() const
Express the path relative to sRoot.
static void SetRoot(const HxStr &root)
Replace sRoot and normalise it.
FilePath()
Construct an empty path.
Definition filepath.h:27
void Load(Stream &stream)
Read a name from stream and set the path to it under sRoot.
void Print(Dbg &sink) const
Write the path to sink in double quotes.
static FilePath sRoot
Directory every relative path is resolved against, empty until SetRoot() is called.
Definition filepath.h:147
static bool IsAbsolute(const HxStr &path)
Report whether a path names its location outright rather than relative to sRoot.
void Normalize()
Lowercase the path, turn backslashes into slashes, and resolve its components.
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
The rendering engine.
Definition animhelper.h:3