CyberEngineMkIII
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Path.hpp
Go to the documentation of this file.
1 #pragma once
3 namespace CYB {
4  namespace API {
9  class Path : public Interop::Allocatable {
10  public:
11  enum : int {
12  MAX_PATH_BYTES = 256,
13  };
15  enum class SystemPath {
17  EXECUTABLE,
18  RESOURCE,
19  TEMPORARY,
20  USER,
21  WORKING,
22  };
38 
41  public:
48  virtual Interop::Object<Path>& operator*(void) noexcept = 0;
55  virtual Interop::Object<Path>* operator->(void) noexcept = 0;
56 
64  virtual void operator++(void) = 0;
65  };
66 
67  public:
74  static const String::Static DirectorySeparatorChar(void) noexcept { return String::Static(u8"/"); }
75 
91  virtual void Append(const String::UTF8& AAppendage, const bool ACreateIfNonExistant, const bool ACreateRecursive) = 0;
101  virtual void NavigateToParentDirectory(void) = 0;
102 
113  virtual void Delete(bool ARecursive) = 0;
114 
123  virtual bool IsDirectory(void) const = 0;
132  virtual bool IsFile(void) const = 0;
133 
142  virtual String::UTF8 FullName(void) const = 0;
150  virtual String::UTF8 Name(void) const = 0;
159  virtual String::UTF8 Extension(void) const = 0;
160 
167  virtual int ByteLength(void) const noexcept = 0;
168 
179  virtual Interop::Object<DirectoryEntry> Contents(void) const = 0;
180 
187  virtual const String::UTF8& operator()(void) const noexcept = 0;
188  };
189  };
190 };
192 CYB_SET_ALLOCATABLE_ID(Path);
193 //! @endcond
A variable length UTF-8 string.
Definition: UTF8String.hpp:8
Template type for wrapping pointers and treating them as objects. Only works with CyberEngine interfa...
Definition: Object.hpp:10
virtual Interop::Object< Path > * operator->(void) noexcept=0
Get the current path the iterator points to. Must be checked for validity after iteration. If invalid, end of iteration has been reached. Can be moved.
Iterator for paths in a directory.
Definition: Path.hpp:40
The directory for storing permanent data associated with the current OS/Steam user, read write.
The path from which the engine was launched, file, read-only.
The directory for storing data relevant only to this execution.
The directory from which the engine was launched, read-only.
virtual Interop::Object< DirectoryEntry > Contents(void) const =0
Get the first directory entry iterator in the path. Always valid.
The directory where program resources are stored, read-only.
A string pointing to unchanging data in the stack above it or the data segment. Must have UTF-8 encod...
Definition: StaticString.hpp:7
SystemPath
Starting points for creating paths.
Definition: Path.hpp:15
virtual void operator++(void)=0
Advance the iterator.
virtual bool IsDirectory(void) const =0
Check if the current path is a directory.
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
virtual void Delete(bool ARecursive)=0
Ensures the current Path doesn't exist. This will invalidate the path.
virtual int ByteLength(void) const noexcept=0
Get the length in bytes of the Path's underlying string.
virtual String::UTF8 Extension(void) const =0
Get the extension of the file without the leading period. Equivalent to FullFileName and FileName if ...
virtual void NavigateToParentDirectory(void)=0
Navigate the path to the parent directory. Does NOT work on invalidated paths.
The current application working directory, permissions indeterminate.
static const String::Static DirectorySeparatorChar(void) noexcept
Get the standardized UTF-8 directory separator string.
Definition: Path.hpp:74
Defines the base class for allocatable engine objects.
Definition: Allocatable.hpp:7
virtual String::UTF8 Name(void) const =0
Get the name of the file without any directory prefixes or extensions. Equivalent to FullFileName and...
Template for defining the types of parameters for engine object constructors with multiple arguments...
Definition: Constructor.hpp:11
virtual String::UTF8 FullName(void) const =0
Get the name of the file without any prefixes. Equivalent to FileName and Extension if the name does ...
virtual bool IsFile(void) const =0
Check if the current path is a file.
virtual void Append(const String::UTF8 &AAppendage, const bool ACreateIfNonExistant, const bool ACreateRecursive)=0
Append a directory/file to the path.
virtual Interop::Object< Path > & operator*(void) noexcept=0
Get the current path the iterator points to. Must be checked for validity after iteration. If invalid, end of iteration has been reached. Can be moved.