MPD  0.20.6
Public Member Functions | Static Public Member Functions
AllocatedPath Class Reference

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
 
AllocatedPathoperator= (const AllocatedPath &)=default
 Copy an AllocatedPath object. More...
 
AllocatedPathoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

AllocatedPath::AllocatedPath ( const AllocatedPath )
default

Copy an AllocatedPath object.

AllocatedPath::AllocatedPath ( AllocatedPath &&  other)
inline

Move an AllocatedPath object.

Definition at line 67 of file AllocatedPath.hxx.

AllocatedPath::AllocatedPath ( Path  other)
inlineexplicit

Definition at line 69 of file AllocatedPath.hxx.

AllocatedPath::~AllocatedPath ( )

Member Function Documentation

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::Build ( const_pointer_type  a,
const_pointer_type  b 
)
inlinestatic

Join two path components with the path separator.

Definition at line 93 of file AllocatedPath.hxx.

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::Build ( Path  a,
const_pointer_type  b 
)
inlinestatic

Definition at line 99 of file AllocatedPath.hxx.

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::Build ( Path  a,
Path  b 
)
inlinestatic

Definition at line 104 of file AllocatedPath.hxx.

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::Build ( const_pointer_type  a,
const AllocatedPath b 
)
inlinestatic

Definition at line 109 of file AllocatedPath.hxx.

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::Build ( const AllocatedPath a,
const_pointer_type  b 
)
inlinestatic

Definition at line 115 of file AllocatedPath.hxx.

static gcc_pure AllocatedPath AllocatedPath::Build ( const AllocatedPath a,
const AllocatedPath b 
)
inlinestatic

Definition at line 121 of file AllocatedPath.hxx.

gcc_pure const_pointer_type AllocatedPath::c_str ( ) const
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.

gcc_pure const_pointer_type AllocatedPath::data ( ) const
inline

Returns a pointer to the raw value, not necessarily null-terminated.

Definition at line 237 of file AllocatedPath.hxx.

static gcc_pure AllocatedPath AllocatedPath::FromFS ( const_pointer_type  fs)
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.

static gcc_pure AllocatedPath AllocatedPath::FromFS ( const_pointer_type  _begin,
const_pointer_type  _end 
)
inlinestatic

Definition at line 137 of file AllocatedPath.hxx.

static gcc_pure AllocatedPath AllocatedPath::FromFS ( string &&  fs)
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.

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::FromUTF8 ( const char *  path_utf8)
static

Convert a UTF-8 C string to an AllocatedPath instance.

Returns return a "nulled" instance on error.

gcc_pure static gcc_nonnull_all AllocatedPath AllocatedPath::FromUTF8Throw ( const char *  path_utf8)
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.

gcc_pure bool AllocatedPath::IsAbsolute ( ) const
inline

Definition at line 273 of file AllocatedPath.hxx.

bool AllocatedPath::IsNull ( ) const
inline

Check if this is a "nulled" instance.

A "nulled" instance must not be used.

Definition at line 200 of file AllocatedPath.hxx.

gcc_pure size_t AllocatedPath::length ( ) const
inline
Returns
the length of this string in number of "value_type" elements (which may not be the number of characters).

Definition at line 218 of file AllocatedPath.hxx.

static gcc_const AllocatedPath AllocatedPath::Null ( )
inlinestatic

Return a "nulled" instance.

Its IsNull() method will return true. Such an object must not be used.

See also
IsNull()

Definition at line 80 of file AllocatedPath.hxx.

gcc_pure AllocatedPath::operator Path ( ) const
inline

Definition at line 85 of file AllocatedPath.hxx.

gcc_pure bool AllocatedPath::operator!= ( const AllocatedPath other) const
inline

Definition at line 184 of file AllocatedPath.hxx.

AllocatedPath& AllocatedPath::operator= ( const AllocatedPath )
default

Copy an AllocatedPath object.

AllocatedPath& AllocatedPath::operator= ( AllocatedPath &&  other)
inline

Move an AllocatedPath object.

Definition at line 173 of file AllocatedPath.hxx.

gcc_pure bool AllocatedPath::operator== ( const AllocatedPath other) const
inline

Definition at line 179 of file AllocatedPath.hxx.

gcc_pure const_pointer_type AllocatedPath::Relative ( Path  other_fs) const
inline

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.

void AllocatedPath::SetNull ( )
inline

Clear this object's value, make it "nulled".

See also
IsNull()

Definition at line 209 of file AllocatedPath.hxx.

string&& AllocatedPath::Steal ( )
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).


The documentation for this class was generated from the following file: