Plasma Engine  2.0
Loading...
Searching...
No Matches
PathUtils.h
1#pragma once
2
3#include <Foundation/Strings/StringView.h>
4#include <Foundation/Strings/UnicodeUtils.h>
5
7
14class PL_FOUNDATION_DLL plPathUtils
15{
16public:
18 static const char OsSpecificPathSeparator;
19
21 static bool IsPathSeparator(plUInt32 c); // [tested]
22
24 static bool IsValidFilenameChar(plUInt32 uiCharacter);
25
29 static bool ContainsInvalidFilenameChars(plStringView sPath);
30
33 static const char* FindPreviousSeparator(const char* szPathStart, const char* szStartSearchAt); // [tested]
34
36 static bool HasAnyExtension(plStringView sPath); // [tested]
37
48 static bool HasExtension(plStringView sPath, plStringView sExtension); // [tested]
49
54 static plStringView GetFileExtension(plStringView sPath, bool bFullExtension = false); // [tested]
55
59 static plStringView GetFileName(plStringView sPath, bool bRemoveFullExtension = false); // [tested]
60
64 static plStringView GetFileNameAndExtension(plStringView sPath); // [tested]
65
73 static plStringView GetFileDirectory(plStringView sPath); // [tested]
74
76 static bool IsAbsolutePath(plStringView sPath); // [tested]
77
79 static bool IsRelativePath(plStringView sPath); // [tested]
80
83 static bool IsRootedPath(plStringView sPath); // [tested]
84
92 static void GetRootedPathParts(plStringView sPath, plStringView& ref_sRoot, plStringView& ref_sRelPath); // [tested]
93
95 static plStringView GetRootedPathRootName(plStringView sPath); // [tested]
96
102 static void MakeValidFilename(plStringView sFilename, plUInt32 uiReplacementCharacter, plStringBuilder& out_sFilename);
103
105 static bool IsSubPath(plStringView sPrefixPath, plStringView sFullPath); // [tested]
107 static bool IsSubPath_NoCase(plStringView sPrefixPath, plStringView sFullPath); // [tested]
108};
109
110#include <Foundation/Strings/Implementation/PathUtils_inl.h>
Contains Helper functions to work with paths.
Definition PathUtils.h:15
static const char OsSpecificPathSeparator
The path separator used by this operating system.
Definition PathUtils.h:18
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