#include <ResourcePath.hpp>
Public Member Functions | |
ResourcePath () | |
ResourcePath (const char *abspath) | |
ResourcePath (std::string const &abspath) | |
ResourcePath & | operator= (const char *abspath) |
ResourcePath & | operator= (std::string const &abspath) |
ResourcePath | operator+ (std::string const &append) const |
ResourcePath & | operator+= (std::string const &append) |
ResourcePath | operator/ (std::string const &join) const |
ResourcePath & | operator/= (std::string const &join) |
const std::string & | string () const |
bool | empty () const |
std::string | to_real_path (const char *vroot) const |
ResourcePath | get_neighbour_path (const char *relative) const |
ResourcePath | get_directory () const |
bool | operator== (ResourcePath const &other) const |
bool | operator!= (ResourcePath const &other) const |
bool | operator< (ResourcePath const &other) const |
Static Public Member Functions | |
static void | Clean (std::string &path) |
Detailed Description
This is used mainly internaly in ResourceManagementSystem and in communication between RMS and ResourceProviders. This is always absolute path (must begin with '/') to the resource (typicaly file, dirs are unusual) in a single-root (no C:, D: letters) virtual file system (it is aggregated from all providers registered to ResourceManagementSystem). To support relative paths and paths to directories, another class (and conversions from/to ResourcePath) should be implemented (or std::path with proper conversions added can be used).
TODO - make sure that this can not point above the virtual root (might hapen if path is form example "/../../..").
- this should be verified using some platform-aware api that verifies the location of target file
- maybe I should move IO handling to some file like this that would do verifications also
- maybe get_neighbour_path is not the best; probably there should be more specific function "create ResourcePath from given string considering that we call it from file with this ResourcePath"
- that would evaluate if the string is absolute or relative and either set absolute virtual path or use "current" ResourcePath to resolve relative path
Definition at line 20 of file ResourcePath.hpp.
Constructor & Destructor Documentation
◆ ResourcePath() [1/3]
iv::ResourcePath::ResourcePath | ( | ) |
Definition at line 89 of file ResourcePath.cpp.
◆ ResourcePath() [2/3]
iv::ResourcePath::ResourcePath | ( | const char * | abspath | ) |
Definition at line 94 of file ResourcePath.cpp.
◆ ResourcePath() [3/3]
iv::ResourcePath::ResourcePath | ( | std::string const & | abspath | ) |
Definition at line 100 of file ResourcePath.cpp.
Member Function Documentation
◆ operator=() [1/2]
ResourcePath & iv::ResourcePath::operator= | ( | const char * | abspath | ) |
Definition at line 112 of file ResourcePath.cpp.
◆ operator=() [2/2]
ResourcePath & iv::ResourcePath::operator= | ( | std::string const & | abspath | ) |
Definition at line 106 of file ResourcePath.cpp.
◆ operator+()
ResourcePath iv::ResourcePath::operator+ | ( | std::string const & | append | ) | const |
Definition at line 118 of file ResourcePath.cpp.
◆ operator+=()
ResourcePath & iv::ResourcePath::operator+= | ( | std::string const & | append | ) |
Definition at line 123 of file ResourcePath.cpp.
◆ operator/()
ResourcePath iv::ResourcePath::operator/ | ( | std::string const & | join | ) | const |
Definition at line 129 of file ResourcePath.cpp.
◆ operator/=()
ResourcePath & iv::ResourcePath::operator/= | ( | std::string const & | join | ) |
Definition at line 135 of file ResourcePath.cpp.
◆ string()
const std::string & iv::ResourcePath::string | ( | ) | const |
Definition at line 142 of file ResourcePath.cpp.
◆ empty()
bool iv::ResourcePath::empty | ( | ) | const |
Definition at line 148 of file ResourcePath.cpp.
◆ to_real_path()
std::string iv::ResourcePath::to_real_path | ( | const char * | vroot | ) | const |
Transforms virtual path contained in this ResourcePath into real path by joining it with given path to virtual root.
Definition at line 153 of file ResourcePath.cpp.
◆ get_neighbour_path()
ResourcePath iv::ResourcePath::get_neighbour_path | ( | const char * | relative | ) | const |
Last part of this resource path is removed and the 'relative' parameter is appended and the result is returned.
Definition at line 194 of file ResourcePath.cpp.
◆ get_directory()
ResourcePath iv::ResourcePath::get_directory | ( | ) | const |
If this ends with a '/', then it returns itself. If this is not a directory, it will return parent directory.
Definition at line 199 of file ResourcePath.cpp.
◆ operator==()
bool iv::ResourcePath::operator== | ( | ResourcePath const & | other | ) | const |
Definition at line 173 of file ResourcePath.cpp.
◆ operator!=()
bool iv::ResourcePath::operator!= | ( | ResourcePath const & | other | ) | const |
Definition at line 180 of file ResourcePath.cpp.
◆ operator<()
bool iv::ResourcePath::operator< | ( | ResourcePath const & | other | ) | const |
Definition at line 187 of file ResourcePath.cpp.
◆ Clean()
|
static |
Definition at line 9 of file ResourcePath.cpp.
The documentation for this class was generated from the following files:
- ivorium_systems/ResourceManagementSystem/ResourcePath.hpp
- ivorium_systems/ResourceManagementSystem/ResourcePath.cpp