CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CYBPath.hpp
Go to the documentation of this file.
1 #pragma once
3 namespace CYB {
4  namespace Platform {
5  namespace System {
10  class Path : public Implementation::Path, public API::Path { //needs public implementation to be properly interstructed
11  public:
22  private:
24  private:
35  static API::String::UTF8 LocateDirectory(const SystemPath ADirectory);
47 
57  static void CreateDirectory(const API::String::UTF8& APath);
68  static void CreateDirectories(API::String::UTF8&& AExistingPath, const API::Container::Deque<API::String::UTF8>& APaths);
69 
79  static void DeleteFile(const API::String::UTF8& APath);
90  static void DeleteDirectory(const API::String::UTF8& APath);
91 
100  static int GetIndexOfLastSeperator(const API::String::UTF8& AString, const char ASeparator) noexcept;
101 
111  static void Evaluate(API::String::UTF8& APath);
112 
122  bool Verify(const API::String::UTF8& APath) const;
123 
132  void SetPath(API::String::UTF8&& APath);
133  public:
134 
143  Path(API::String::UTF8&& APath);
154  Path(const SystemPath ADirectory);
160  Path(const Path& ACopy) = default;
161  Path(Path&& AMove) noexcept = default;
162  Path& operator=(Path&& AMove) noexcept = default;
163  ~Path() final override = default;
164 
166  void Append(const API::String::UTF8& AAppendage, const bool ACreateIfNonExistant, const bool ACreateRecursive) final override;
168  void NavigateToParentDirectory(void) final override;
169 
171  void Delete(bool ARecursive) final override;
172 
174  bool IsDirectory(void) const final override;
176  bool IsFile(void) const final override;
177 
179  API::String::UTF8 FullName(void) const final override;
181  API::String::UTF8 Name(void) const final override;
183  API::String::UTF8 Extension(void) const final override;
184 
186  int ByteLength(void) const noexcept final override;
188  API::Interop::Object<API::Path::DirectoryEntry> Contents(void) const final override;
189 
191  const API::String::UTF8& operator()(void) const noexcept final override;
192  };
193  };
194  };
195 };
A variable length UTF-8 string.
Definition: UTF8String.hpp:8
static void CreateDirectories(API::String::UTF8 &&AExistingPath, const API::Container::Deque< API::String::UTF8 > &APaths)
Try and create a set of directories.
Definition: CYBPath.cpp:21
Path() noexcept=default
See Default Constructors and Destructor.
API::String::UTF8 Name(void) const finaloverride
Get the name of the file without any directory prefixes or extensions. Equivalent to FullFileName and...
Iterator for paths in a directory.
Definition: Path.hpp:40
static API::String::UTF8 LocateDirectory(const SystemPath ADirectory)
Get the string path of a SystemPath.
Definition: CYBWin32Path.cpp:7
static void Evaluate(API::String::UTF8 &APath)
Evaluates '..' and '.' references within the path.
bool IsDirectory(void) const finaloverride
Check if the current path is a directory.
static void CreateDirectory(const API::String::UTF8 &APath)
Ensure the existance of a single directory. Path's before it must exist.
API::Interop::Object< API::Path::DirectoryEntry > Contents(void) const finaloverride
Get the first directory entry iterator in the path. Always valid.
Definition: CYBPath.cpp:163
SystemPath
Starting points for creating paths.
Definition: Path.hpp:15
Used for manipulating Paths. Paths will always exist either as a file or directory. Paths are '/' delimited when forming though may not be while retrieving. File names ".." will ascend a directory and '.' represents a no-op.
Definition: Path.hpp:9
static void DeleteFile(const API::String::UTF8 &APath)
Ensure the non-existance of a single file. Path's before it must exist. Directory must be empty...
Adds a UTF16 accompaniment to the UTF8 string of System::Path.
bool Verify(const API::String::UTF8 &APath) const
Verifys the path pointed to exists.
API::String::UTF8 Extension(void) const finaloverride
Get the extension of the file without the leading period. Equivalent to FullFileName and FileName if ...
Definition: CYBPath.cpp:155
bool IsFile(void) const finaloverride
Check if the current path is a file.
Definition: CYBPath.cpp:147
std::deque< AType, Interop::STLAllocator< AType >> Deque
std::deque algorithms using the CyberEngine's allocator
Definition: Containers.hpp:10
API::String::UTF8 FullName(void) const finaloverride
Get the name of the file without any prefixes. Equivalent to FileName and Extension if the name does ...
void NavigateToParentDirectory(void) finaloverride
Navigate the path to the parent directory. Does NOT work on invalidated paths.
void SetPath(API::String::UTF8 &&APath)
Sets the current Path string.
API::String::UTF8 FPath
The underlying string.
Definition: CYBPath.hpp:23
static API::String::UTF8 GetResourceDirectory(void)
Get the string path of SystemDirectory::RESOURCE.
Definition: CYBPath.cpp:34
static void DeleteDirectory(const API::String::UTF8 &APath)
Ensure the non-existance of a single directory. Path's before it must exist. Directory must be empty...
Used for manipulating Paths. Paths will always exist either as a file or directory. Paths are '/' delimited when forming though may not be while retrieving. File names ".." will ascend a directory and '.' represents a no-op.
Definition: CYBPath.hpp:10
static int GetIndexOfLastSeperator(const API::String::UTF8 &AString, const char ASeparator) noexcept
Get the index of the last of a given seperator in a string.
Definition: CYBPath.cpp:6
int ByteLength(void) const noexceptfinaloverride
Get the length in bytes of the Path's underlying string.
Definition: CYBPath.cpp:151
Template for defining the types of parameters for engine object constructors with multiple arguments...
Definition: Constructor.hpp:11
void Delete(bool ARecursive) finaloverride
Ensures the current Path doesn't exist. This will invalidate the path.
Definition: CYBPath.cpp:120
void Append(const API::String::UTF8 &AAppendage, const bool ACreateIfNonExistant, const bool ACreateRecursive) finaloverride
Append a directory/file to the path.
Definition: CYBPath.cpp:50