CyberEngineMkIII
|
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. More...
#include <Path.hpp>
Classes | |
class | DirectoryEntry |
Iterator for paths in a directory. More... | |
Public Types | |
enum | : int { MAX_PATH_BYTES = 256 } |
enum | SystemPath { SystemPath::EXECUTABLE_IMAGE, SystemPath::EXECUTABLE, SystemPath::RESOURCE, SystemPath::TEMPORARY, SystemPath::USER, SystemPath::WORKING } |
Starting points for creating paths. More... | |
using | Constructor = Interop::Constructor< SystemPath > |
See Interop Construction. Get the Path of a given SystemPath. More... | |
using | CopyConstructor = API::Interop::Constructor< const Path & > |
See Interop Construction. | |
![]() | |
enum | ID { ID::NULL_ID, ID::File, ID::Mutex, ID::Path, ID::Semaphore } |
Defines the IDs of allocatable engine objects. More... | |
using | Constructor = NullConstructor |
Override in descendants. | |
using | CopyConstructor = NullConstructor |
Override in descendants. | |
Public Member Functions | |
virtual void | Append (const String::UTF8 &AAppendage, const bool ACreateIfNonExistant, const bool ACreateRecursive)=0 |
Append a directory/file to the path. More... | |
virtual void | NavigateToParentDirectory (void)=0 |
Navigate the path to the parent directory. Does NOT work on invalidated paths. More... | |
virtual void | Delete (bool ARecursive)=0 |
Ensures the current Path doesn't exist. This will invalidate the path. More... | |
virtual bool | IsDirectory (void) const =0 |
Check if the current path is a directory. More... | |
virtual bool | IsFile (void) const =0 |
Check if the current path is a file. More... | |
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 not contain a period. Path can point to a file or directory. More... | |
virtual String::UTF8 | Name (void) const =0 |
Get the name of the file without any directory prefixes or extensions. Equivalent to FullFileName and Extension if the name does not contain a period. Path can point to a file or directory. More... | |
virtual String::UTF8 | Extension (void) const =0 |
Get the extension of the file without the leading period. Equivalent to FullFileName and FileName if the name does not contain a period. Path can point to a file or directory. More... | |
virtual int | ByteLength (void) const noexcept=0 |
Get the length in bytes of the Path's underlying string. More... | |
virtual Interop::Object < DirectoryEntry > | Contents (void) const =0 |
Get the first directory entry iterator in the path. Always valid. More... | |
virtual const String::UTF8 & | operator() (void) const noexcept=0 |
Public access to the underlying string. More... | |
![]() | |
virtual | ~Allocatable ()=default |
See Default Constructors and Destructor. | |
Static Public Member Functions | |
static const String::Static | DirectorySeparatorChar (void) noexcept |
Get the standardized UTF-8 directory separator string. More... | |
![]() | |
template<class AParent > | |
static constexpr ID | GetID (void) |
Returns the ID of an allocatable object. More... | |
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.
See Interop Construction. Get the Path of a given SystemPath.
ADirectory
is given
|
strong |
Starting points for creating paths.
|
pure virtual |
Append a directory/file to the path.
AAppendage | The string to append to the path. This may contain '/'s and ".."s as required, though they should never start or end with '/'. If the last file in the path does not exist, the function will still succeed, however, further calls on the object will generate a CYB::Exception::SystemData::PATH_LOST error. This is to enable creation of new files |
ACreateIfNonExistant | Create the end of path as a directory if it does not exist. If this is true then the last path token in AAppendage must not be ".." |
ACreateRecursive | Create the path recursively. If this is true none of the path tokens in AAppendage should be "..", if one is it will be treated as unreadable. Ignored if ACreateIfNonExistant is false |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::HEAP_ALLOCATION_FAILURE. Thrown if the current heap runs out of memory |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if a directory component of AAppendage could not be read |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_WRITABLE. Thrown if ACreateIfNonExistant is true and the new path could not be created. Filesystem state will be reverted even while doing recursive creation |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::PATH_TOO_LONG. Thrown if the new path would exceed the limitation |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::PATH_LOST. Thrown if the current path failed to verify |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
pure virtualnoexcept |
Get the length in bytes of the Path's underlying string.
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Get the first directory entry iterator in the path. Always valid.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if enumeration permission was denied |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::HEAP_ALLOCATION_FAILURE. Thrown if the current heap runs out of memory |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::PATH_LOST. Thrown if the current path failed to verify or is not a directory |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Ensures the current Path doesn't exist. This will invalidate the path.
ARecursive | If true and IsDirectory() returns true, all files in the directory represented by this path will be deleted along with the directory |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::DIRECTORY_NOT_EMPTY. Thrown if the directory is not empty |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::HEAP_ALLOCATION_FAILURE. Thrown if the current heap runs out of memory |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_WRITABLE. Thrown if the file/directory could not be deleted |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
inlinestaticnoexcept |
|
pure virtual |
Get the extension of the file without the leading period. Equivalent to FullFileName and FileName if the name does not contain a period. Path can point to a file or directory.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if a directory component of the path could not be read |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Get the name of the file without any prefixes. Equivalent to FileName and Extension if the name does not contain a period. Path can point to a file or directory.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if a directory component of the path could not be read |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Check if the current path is a directory.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if a directory component of the path could not be read |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::PATH_LOST. Thrown if the current path failed to verify |
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Check if the current path is a file.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if a directory component of the path could not be read |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::PATH_LOST. Thrown if the current path failed to verify |
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Get the name of the file without any directory prefixes or extensions. Equivalent to FullFileName and Extension if the name does not contain a period. Path can point to a file or directory.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
pure virtual |
Navigate the path to the parent directory. Does NOT work on invalidated paths.
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::HEAP_ALLOCATION_FAILURE. Thrown if the current heap runs out of memory |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STREAM_NOT_READABLE. Thrown if access to parent directory is denied or the Path is currently the root directory. |
CYB::Exception::SystemData | Error code: CYB::Exception::SystemData::STRING_VALIDATION_FAILURE. Thrown if the path string does not validate |
Implemented in CYB::Platform::System::Path.
|
pure virtualnoexcept |
Public access to the underlying string.
Implemented in CYB::Platform::System::Path.