MPD  0.20.18
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 noexcept
 
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 noexcept
 
gcc_pure bool operator!= (const AllocatedPath &other) const noexcept
 
string && Steal ()
 Allows the caller to "steal" the internal value by providing a rvalue reference to the std::string attribute. More...
 
bool IsNull () const noexcept
 Check if this is a "nulled" instance. More...
 
void SetNull () noexcept
 Clear this object's value, make it "nulled". More...
 
gcc_pure size_t length () const noexcept
 
gcc_pure const_pointer_type c_str () const noexcept
 Returns the value as a const C string. More...
 
gcc_pure const_pointer_type data () const noexcept
 Returns a pointer to the raw value, not necessarily null-terminated. More...
 
gcc_pure std::string ToUTF8 () const noexcept
 Convert the path to UTF-8. More...
 
gcc_pure AllocatedPath GetDirectoryName () const noexcept
 Gets directory name of this path. More...
 
gcc_pure const_pointer_type Relative (Path other_fs) const noexcept
 Determine the relative part of the given path to this object, not including the directory separator. More...
 
void ChopSeparators () noexcept
 Chop trailing directory separators. More...
 
gcc_pure bool IsAbsolute () const noexcept
 

Static Public Member Functions

static gcc_const AllocatedPath Null () noexcept
 Return a "nulled" instance. More...
 
gcc_pure static gcc_nonnull_all AllocatedPath Build (const_pointer_type a, const_pointer_type b) noexcept
 Join two path components with the path separator. More...
 
gcc_pure static gcc_nonnull_all AllocatedPath Build (Path a, const_pointer_type b) noexcept
 
gcc_pure static gcc_nonnull_all AllocatedPath Build (Path a, Path b) noexcept
 
gcc_pure static gcc_nonnull_all AllocatedPath Build (const_pointer_type a, const AllocatedPath &b) noexcept
 
gcc_pure static gcc_nonnull_all AllocatedPath Build (const AllocatedPath &a, const_pointer_type b) noexcept
 
static gcc_pure AllocatedPath Build (const AllocatedPath &a, const AllocatedPath &b) noexcept
 
static gcc_pure AllocatedPath FromFS (const_pointer_type fs) noexcept
 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) noexcept
 
static gcc_pure AllocatedPath FromFS (string &&fs) noexcept
 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) noexcept
 Convert a UTF-8 C string to an AllocatedPath instance. More...
 
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 
)
inlinestaticnoexcept

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 
)
inlinestaticnoexcept

Definition at line 100 of file AllocatedPath.hxx.

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

Definition at line 105 of file AllocatedPath.hxx.

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

Definition at line 110 of file AllocatedPath.hxx.

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

Definition at line 117 of file AllocatedPath.hxx.

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

Definition at line 124 of file AllocatedPath.hxx.

gcc_pure const_pointer_type AllocatedPath::c_str ( ) const
inlinenoexcept

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 231 of file AllocatedPath.hxx.

void AllocatedPath::ChopSeparators ( )
noexcept

Chop trailing directory separators.

gcc_pure const_pointer_type AllocatedPath::data ( ) const
inlinenoexcept

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

Definition at line 240 of file AllocatedPath.hxx.

static gcc_pure AllocatedPath AllocatedPath::FromFS ( const_pointer_type  fs)
inlinestaticnoexcept

Convert a C string that is already in the filesystem character set to a Path instance.

Definition at line 135 of file AllocatedPath.hxx.

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

Definition at line 140 of file AllocatedPath.hxx.

static gcc_pure AllocatedPath AllocatedPath::FromFS ( string &&  fs)
inlinestaticnoexcept

Convert a C++ string that is already in the filesystem character set to a Path instance.

Definition at line 150 of file AllocatedPath.hxx.

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

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

Returns return a "nulled" instance on error.

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
noexcept

Gets directory name of this path.

Returns a "nulled" instance on error.

gcc_pure bool AllocatedPath::IsAbsolute ( ) const
inlinenoexcept

Definition at line 276 of file AllocatedPath.hxx.

bool AllocatedPath::IsNull ( ) const
inlinenoexcept

Check if this is a "nulled" instance.

A "nulled" instance must not be used.

Definition at line 203 of file AllocatedPath.hxx.

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

Definition at line 221 of file AllocatedPath.hxx.

static gcc_const AllocatedPath AllocatedPath::Null ( )
inlinestaticnoexcept

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
inlinenoexcept

Definition at line 85 of file AllocatedPath.hxx.

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

Definition at line 187 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 176 of file AllocatedPath.hxx.

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

Definition at line 182 of file AllocatedPath.hxx.

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

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 266 of file AllocatedPath.hxx.

void AllocatedPath::SetNull ( )
inlinenoexcept

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

See also
IsNull()

Definition at line 212 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 195 of file AllocatedPath.hxx.

gcc_pure std::string AllocatedPath::ToUTF8 ( ) const
noexcept

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: