Plasma Engine  2.0
Loading...
Searching...
No Matches
DataDirPath.h
1#pragma once
2
3#include <ToolsFoundation/ToolsFoundationDLL.h>
4
5#include <Foundation/IO/Stream.h>
6
17class PL_TOOLSFOUNDATION_DLL plDataDirPath
18{
19public:
22
29 plDataDirPath(plStringView sAbsPath, plArrayPtr<plString> dataDirRoots, plUInt32 uiLastKnownDataDirIndex = 0);
31 plDataDirPath(const plStringBuilder& sAbsPath, plArrayPtr<plString> dataDirRoots, plUInt32 uiLastKnownDataDirIndex = 0);
33 plDataDirPath(plString&& sAbsPath, plArrayPtr<plString> dataDirRoots, plUInt32 uiLastKnownDataDirIndex = 0);
34
35
39
41 const plString& GetAbsolutePath() const;
43 bool IsValid() const;
45 void Clear();
46
50
51 operator plStringView() const;
52 bool operator==(plStringView rhs) const;
53 bool operator!=(plStringView rhs) const;
54
58
60 plStringView GetDataDirParentRelativePath() const;
62 plStringView GetDataDirRelativePath() const;
64 plStringView GetDataDir() const;
66 plUInt8 GetDataDirIndex() const;
67
71
76 bool UpdateDataDirInfos(plArrayPtr<plString> dataDirRoots, plUInt32 uiLastKnownDataDirIndex = 0) const;
77
81
82 plStreamWriter& Write(plStreamWriter& inout_stream) const;
83 plStreamReader& Read(plStreamReader& inout_stream);
84
86
87private:
88 plString m_sAbsolutePath;
89 mutable plUInt16 m_uiDataDirParent = 0;
90 mutable plUInt8 m_uiDataDirLength = 0;
91 mutable plUInt8 m_uiDataDirIndex = 0;
92};
93
94plStreamWriter& operator<<(plStreamWriter& inout_stream, const plDataDirPath& value);
95plStreamReader& operator>>(plStreamReader& inout_stream, plDataDirPath& out_value);
96
101struct PL_TOOLSFOUNDATION_DLL plCompareDataDirPath
102{
103 static inline bool Less(plStringView lhs, plStringView rhs);
104 static inline bool Equal(plStringView lhs, plStringView rhs);
105};
106
107#include <ToolsFoundation/FileSystem/Implementation/DataDirPath_inl.h>
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
A reference to a file or folder inside a data directory.
Definition DataDirPath.h:18
plDataDirPath()
Default ctor, creates an invalid data directory path.
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
plStringBuilder is a class that is meant for creating and modifying strings.
Definition StringBuilder.h:35
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Comparator that first sort case-insensitive and then case-sensitive if necessary for a unique orderin...
Definition DataDirPath.h:102