MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Static Public Member Functions
Path Class Reference

A path name in the native file system character set. More...

`#include <Path.hxx>`

Inheritance diagram for Path:
[legend]
Collaboration diagram for Path:
[legend]

## Public Member Functions
constexpr | Path (const Path &)=default
| Copy a Path object. More...
Path & | operator= (const Path &)=default
| Copy a Path object. 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 bool | HasNewline () const
| Does the path contain a newline character? (Which is usually rejected by MPD because its protocol cannot transfer newline characters). More...
gcc_pure std::string | ToUTF8 () const
| Convert the path to UTF-8. More...
gcc_pure Path | GetBase () const
| Determine the "base" file name. 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...
gcc_pure bool | IsAbsolute () const
gcc_pure const_pointer_type | GetSuffix () const
Public Member Functions inherited from StringPointer< T >
| StringPointer ()=default
constexpr | StringPointer (const_pointer_type _value)
constexpr bool | IsNull () const
| Check if this is a "nulled" instance. More...
constexpr const_pointer_type | c_str () const
bool | empty () const

## Static Public Member Functions
static constexpr Path | Null ()
| Return a "nulled" instance. More...
static constexpr Path | FromFS (const_pointer_type fs)
| Create a new instance pointing to the specified path string. More...

## Additional Inherited Members
Public Types inherited from StringPointer< T >
typedef T | value_type
typedef T & | reference_type
typedef const T & | const_reference_type
typedef T * | pointer_type
typedef const T * | const_pointer_type
Static Public Attributes inherited from StringPointer< T >
static constexpr value_type | SENTINEL = '\0'

## Detailed Description

A path name in the native file system character set.

This class manages a pointer to an existing path string. While an instance lives, the string must not be invalidated.

Definition at line 39 of file Path.hxx.

## Constructor & Destructor Documentation

constexpr Path::Path | ( | const Path & |  | ) |
| default

Copy a Path object.

## Member Function Documentation

gcc_pure const_pointer_type Path::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 107 of file Path.hxx.

gcc_pure const_pointer_type Path::data | ( |  | ) | const
| inline

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

Definition at line 116 of file Path.hxx.

static constexpr Path Path::FromFS | ( | const_pointer_type | fs | ) |
| inline static

Create a new instance pointing to the specified path string.

Definition at line 64 of file Path.hxx.

gcc_pure Path Path::GetBase | ( |  | ) | const
| inline

Determine the "base" file name.

The return value points inside this object.

Definition at line 143 of file Path.hxx.

gcc_pure AllocatedPath Path::GetDirectoryName | ( |  | ) | const

Gets directory name of this path.

Returns a "nulled" instance on error.

gcc_pure const_pointer_type Path::GetSuffix | ( |  | ) | const

gcc_pure bool Path::HasNewline | ( |  | ) | const
| inline

Does the path contain a newline character? (Which is usually rejected by MPD because its protocol cannot transfer newline characters).

Definition at line 126 of file Path.hxx.

gcc_pure bool Path::IsAbsolute | ( |  | ) | const
| inline

Definition at line 166 of file Path.hxx.

bool Path::IsNull | ( |  | ) | const
| inline

Check if this is a "nulled" instance.

A "nulled" instance must not be used.

Definition at line 77 of file Path.hxx.

gcc_pure size_t Path::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 95 of file Path.hxx.

static constexpr Path Path::Null | ( |  | ) |
| inline static

Return a "nulled" instance.

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

See also
  IsNull()

Definition at line 56 of file Path.hxx.

Path& Path::operator= | ( | const Path & |  | ) |
| default

Copy a Path object.

gcc_pure const_pointer_type Path::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 161 of file Path.hxx.

void Path::SetNull | ( |  | ) |
| inline

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

See also
  IsNull()

Definition at line 86 of file Path.hxx.

gcc_pure std::string Path::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:

- fs/Path.hxx