MPD
0.20.6
|
A path name in the native file system character set. More...
#include <AllocatedPath.hxx>
Public Member Functions | |
AllocatedPath (const AllocatedPath &)=default | |
Copy an AllocatedPath object. More... | |
AllocatedPath (AllocatedPath &&other) | |
Move an AllocatedPath object. More... | |
AllocatedPath (Path other) | |
~AllocatedPath () | |
gcc_pure | operator Path () const |
AllocatedPath & | operator= (const AllocatedPath &)=default |
Copy an AllocatedPath object. More... | |
AllocatedPath & | operator= (AllocatedPath &&other) |
Move an AllocatedPath object. More... | |
gcc_pure bool | operator== (const AllocatedPath &other) const |
gcc_pure bool | operator!= (const AllocatedPath &other) const |
string && | Steal () |
Allows the caller to "steal" the internal value by providing a rvalue reference to the std::string attribute. More... | |
bool | IsNull () const |
Check if this is a "nulled" instance. More... | |
void | SetNull () |
Clear this object's value, make it "nulled". More... | |
gcc_pure size_t | length () const |
gcc_pure const_pointer_type | c_str () const |
Returns the value as a const C string. More... | |
gcc_pure const_pointer_type | data () const |
Returns a pointer to the raw value, not necessarily null-terminated. More... | |
gcc_pure std::string | ToUTF8 () const |
Convert the path to UTF-8. More... | |
gcc_pure AllocatedPath | GetDirectoryName () const |
Gets directory name of this path. More... | |
gcc_pure const_pointer_type | Relative (Path other_fs) const |
Determine the relative part of the given path to this object, not including the directory separator. More... | |
void | ChopSeparators () |
Chop trailing directory separators. More... | |
gcc_pure bool | IsAbsolute () const |
Static Public Member Functions | |
static gcc_const AllocatedPath | Null () |
Return a "nulled" instance. More... | |
gcc_pure static gcc_nonnull_all AllocatedPath | Build (const_pointer_type a, const_pointer_type b) |
Join two path components with the path separator. More... | |
gcc_pure static gcc_nonnull_all AllocatedPath | Build (Path a, const_pointer_type b) |
gcc_pure static gcc_nonnull_all AllocatedPath | Build (Path a, Path b) |
gcc_pure static gcc_nonnull_all AllocatedPath | Build (const_pointer_type a, const AllocatedPath &b) |
gcc_pure static gcc_nonnull_all AllocatedPath | Build (const AllocatedPath &a, const_pointer_type b) |
static gcc_pure AllocatedPath | Build (const AllocatedPath &a, const AllocatedPath &b) |
static gcc_pure AllocatedPath | FromFS (const_pointer_type fs) |
Convert a C string that is already in the filesystem character set to a Path instance. More... | |
static gcc_pure AllocatedPath | FromFS (const_pointer_type _begin, const_pointer_type _end) |
static gcc_pure AllocatedPath | FromFS (string &&fs) |
Convert a C++ string that is already in the filesystem character set to a Path instance. More... | |
gcc_pure static gcc_nonnull_all AllocatedPath | FromUTF8 (const char *path_utf8) |
Convert a UTF-8 C string to an AllocatedPath instance. More... | |
gcc_pure static gcc_nonnull_all AllocatedPath | FromUTF8Throw (const char *path_utf8) |
Convert a UTF-8 C string to an AllocatedPath instance. More... | |
A path name in the native file system character set.
This class manages the memory chunk where this path string is stored.
Definition at line 38 of file AllocatedPath.hxx.
|
default |
Copy an AllocatedPath object.
|
inline |
Move an AllocatedPath object.
Definition at line 67 of file AllocatedPath.hxx.
|
inlineexplicit |
Definition at line 69 of file AllocatedPath.hxx.
AllocatedPath::~AllocatedPath | ( | ) |
|
inlinestatic |
Join two path components with the path separator.
Definition at line 93 of file AllocatedPath.hxx.
|
inlinestatic |
Definition at line 99 of file AllocatedPath.hxx.
|
inlinestatic |
Definition at line 104 of file AllocatedPath.hxx.
|
inlinestatic |
Definition at line 109 of file AllocatedPath.hxx.
|
inlinestatic |
Definition at line 115 of file AllocatedPath.hxx.
|
inlinestatic |
Definition at line 121 of file AllocatedPath.hxx.
|
inline |
Returns the value as a const C string.
The returned pointer is invalidated whenever the value of life of this instance ends.
Definition at line 228 of file AllocatedPath.hxx.
void AllocatedPath::ChopSeparators | ( | ) |
Chop trailing directory separators.
|
inline |
Returns a pointer to the raw value, not necessarily null-terminated.
Definition at line 237 of file AllocatedPath.hxx.
|
inlinestatic |
Convert a C string that is already in the filesystem character set to a Path instance.
Definition at line 132 of file AllocatedPath.hxx.
|
inlinestatic |
Definition at line 137 of file AllocatedPath.hxx.
|
inlinestatic |
Convert a C++ string that is already in the filesystem character set to a Path instance.
Definition at line 147 of file AllocatedPath.hxx.
|
static |
Convert a UTF-8 C string to an AllocatedPath instance.
Returns return a "nulled" instance on error.
|
static |
Convert a UTF-8 C string to an AllocatedPath instance.
Throws a std::runtime_error on error.
gcc_pure AllocatedPath AllocatedPath::GetDirectoryName | ( | ) | const |
Gets directory name of this path.
Returns a "nulled" instance on error.
|
inline |
Definition at line 273 of file AllocatedPath.hxx.
|
inline |
Check if this is a "nulled" instance.
A "nulled" instance must not be used.
Definition at line 200 of file AllocatedPath.hxx.
|
inline |
Definition at line 218 of file AllocatedPath.hxx.
|
inlinestatic |
Return a "nulled" instance.
Its IsNull() method will return true. Such an object must not be used.
Definition at line 80 of file AllocatedPath.hxx.
Definition at line 85 of file AllocatedPath.hxx.
|
inline |
Definition at line 184 of file AllocatedPath.hxx.
|
default |
Copy an AllocatedPath object.
|
inline |
Move an AllocatedPath object.
Definition at line 173 of file AllocatedPath.hxx.
|
inline |
Definition at line 179 of file AllocatedPath.hxx.
Determine the relative part of the given path to this object, not including the directory separator.
Returns an empty string if the given path equals this object or nullptr on mismatch.
Definition at line 263 of file AllocatedPath.hxx.
|
inline |
Clear this object's value, make it "nulled".
Definition at line 209 of file AllocatedPath.hxx.
|
inline |
Allows the caller to "steal" the internal value by providing a rvalue reference to the std::string attribute.
Definition at line 192 of file AllocatedPath.hxx.
gcc_pure std::string AllocatedPath::ToUTF8 | ( | ) | const |
Convert the path to UTF-8.
Returns empty string on error or if this instance is "nulled" (IsNull returns true).