libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
FilePath Class Reference

Simple value type wrapping std::filesystem::path. More...

#include <filepath.h>

Public Member Functions

 FilePath ()=default
 Constructs an empty file path.
 
 FilePath (const String &path)
 Constructs a FilePath from a String.
 
 FilePath (const char *path)
 Constructs a FilePath from a C string.
 
 FilePath (const std::filesystem::path &path)
 Constructs a FilePath from a std::filesystem::path.
 
bool isEmpty () const
 Returns true if the path is empty.
 
String fileName () const
 Returns the filename component (including extension).
 
String baseName () const
 Returns the filename without its extension.
 
String suffix () const
 Returns the file extension without the leading dot.
 
String completeSuffix () const
 Returns the complete suffix (all extensions).
 
FilePath parent () const
 Returns the parent directory as a FilePath.
 
FilePath join (const FilePath &other) const
 Joins this path with another path component.
 
FilePath operator/ (const FilePath &other) const
 Joins this path with another path component.
 
FilePath operator/ (const String &other) const
 Joins this path with a string path component.
 
FilePath operator/ (const char *other) const
 Joins this path with a C string path component.
 
bool exists () const
 Returns true if the path exists on the filesystem.
 
bool isAbsolute () const
 Returns true if the path is absolute.
 
bool isRelative () const
 Returns true if the path is relative.
 
FilePath absolutePath () const
 Returns the absolute form of this path.
 
String toString () const
 Converts the path to a String.
 
const std::filesystem::path & toStdPath () const
 Returns the underlying std::filesystem::path.
 
bool operator== (const FilePath &other) const
 Equality comparison.
 
bool operator!= (const FilePath &other) const
 Inequality comparison.
 
bool operator< (const FilePath &other) const
 Less-than comparison for ordered containers.
 

Detailed Description

Simple value type wrapping std::filesystem::path.

Provides a convenient interface for path decomposition, joining, and filesystem queries. This is a simple data object — always copied by value, no shared ownership.

This class is not thread-safe. Concurrent access to a single instance requires external synchronization.

Constructor & Destructor Documentation

◆ FilePath() [1/3]

FilePath::FilePath ( const String path)
inline

Constructs a FilePath from a String.

Parameters
pathThe path string.

◆ FilePath() [2/3]

FilePath::FilePath ( const char path)
inline

Constructs a FilePath from a C string.

Parameters
pathThe path string.

◆ FilePath() [3/3]

FilePath::FilePath ( const std::filesystem::path &  path)
inline

Constructs a FilePath from a std::filesystem::path.

Parameters
pathThe filesystem path.

Member Function Documentation

◆ absolutePath()

FilePath FilePath::absolutePath ( ) const
inline

Returns the absolute form of this path.

Returns
A FilePath with the absolute path.

◆ baseName()

String FilePath::baseName ( ) const
inline

Returns the filename without its extension.

Returns
The stem as a String.

◆ completeSuffix()

String FilePath::completeSuffix ( ) const
inline

Returns the complete suffix (all extensions).

For "archive.tar.gz", returns "tar.gz".

Returns
The complete suffix as a String.

◆ exists()

bool FilePath::exists ( ) const
inline

Returns true if the path exists on the filesystem.

Returns
true if the path refers to an existing entry.

◆ fileName()

String FilePath::fileName ( ) const
inline

Returns the filename component (including extension).

Returns
The filename as a String.

◆ isAbsolute()

bool FilePath::isAbsolute ( ) const
inline

Returns true if the path is absolute.

Returns
true if the path is an absolute path.

◆ isEmpty()

bool FilePath::isEmpty ( ) const
inline

Returns true if the path is empty.

Returns
true if the path has no components.

◆ isRelative()

bool FilePath::isRelative ( ) const
inline

Returns true if the path is relative.

Returns
true if the path is a relative path.

◆ join()

FilePath FilePath::join ( const FilePath other) const
inline

Joins this path with another path component.

Parameters
otherThe path component to append.
Returns
A new FilePath with the joined result.

◆ operator/() [1/3]

FilePath FilePath::operator/ ( const char other) const
inline

Joins this path with a C string path component.

Parameters
otherThe path component to append.
Returns
A new FilePath with the joined result.

◆ operator/() [2/3]

FilePath FilePath::operator/ ( const FilePath other) const
inline

Joins this path with another path component.

Parameters
otherThe path component to append.
Returns
A new FilePath with the joined result.

◆ operator/() [3/3]

FilePath FilePath::operator/ ( const String other) const
inline

Joins this path with a string path component.

Parameters
otherThe path component to append.
Returns
A new FilePath with the joined result.

◆ parent()

FilePath FilePath::parent ( ) const
inline

Returns the parent directory as a FilePath.

Returns
The parent directory path.

◆ suffix()

String FilePath::suffix ( ) const
inline

Returns the file extension without the leading dot.

Returns
The suffix as a String (e.g. "png", "wav").

◆ toStdPath()

const std::filesystem::path & FilePath::toStdPath ( ) const
inline

Returns the underlying std::filesystem::path.

Returns
A const reference to the internal path.

◆ toString()

String FilePath::toString ( ) const
inline

Converts the path to a String.

Returns
The path as a String.

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