ActiveLib
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
active::file::Path Class Reference

Class to represent the path of a node in the local file system. More...

#include <Path.h>

Inheritance diagram for active::file::Path:
Inheritance graph
[legend]
Collaboration diagram for active::file::Path:
Collaboration graph
[legend]

Public Types

using Unique = std::unique_ptr<Path>
 Unique pointer.
 
using Shared = std::shared_ptr<Path>
 Unique pointer.
 

Public Member Functions

 Path ()
 
 Path (const utility::String &path, bool isRelative=false)
 
 Path (const std::filesystem::path &path)
 
 Path (const Path &source)
 
 ~Path ()
 
PathclonePtr () const
 
Pathoperator= (const Path &source)
 
bool operator== (const Path &ref) const
 
bool operator!= (const Path &ref) const
 
Path operator/ (const utility::String &toAppend) const
 
Path operator+ (const utility::String &toAppend) const
 
Pathoperator/= (const utility::String &toAppend)
 
Pathoperator+= (const utility::String &toConcat)
 
 operator const std::filesystem::path & () const
 
 operator utility::String () const
 
bool empty () const
 
utility::String getNodeName (bool isExtensionDeleted=false) const
 
utility::String getExtension () const
 
utility::String platformSpecific () const
 
Path rootDirectory () const
 
Path rootName () const
 
Path rootPath () const
 
Path relativePath () const
 
Path lexicallyNormal () const
 
bool hasFileName () const
 
Pathappend (const utility::String &toAppend)
 
Pathconcat (const utility::String &toConcat)
 
PathremoveFileName ()
 
PathreplaceFileName (const utility::String &replacement=utility::String{})
 
PathreplaceExtension (const utility::String &replacement=utility::String{})
 
- Public Member Functions inherited from active::utility::Cloner
virtual ~Cloner ()=default
 

Static Public Member Functions

static Path current ()
 

Static Public Attributes

static const utility::String delimiter = "/"
 The path delimiter expression for the current platform.
 

Detailed Description

Class to represent the path of a node in the local file system.

Constructor & Destructor Documentation

◆ Path() [1/4]

Path::Path ( )

Constructor

Here is the caller graph for this function:

◆ Path() [2/4]

Path::Path ( const utility::String & path,
bool isRelative = false )

Constructor

Parameters
pathThe path (typically plaform-specific)
isRelativeTrue if the path is relative to the current path
Here is the call graph for this function:

◆ Path() [3/4]

Path::Path ( const std::filesystem::path & path)

Constructor

Parameters
pathA file system path

◆ Path() [4/4]

Path::Path ( const Path & source)

Copy constructor

Parameters
sourceThe object to copy

◆ ~Path()

active::file::Path::~Path ( )
inline

Destructor

Member Function Documentation

◆ append()

Path & Path::append ( const utility::String & toAppend)

Appends a name to the path (with a prefixed directory separator)

Parameters
toAppendThe string to append to this path (with a directory separator)
Returns
A reference to this
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clonePtr()

Path * active::file::Path::clonePtr ( ) const
inlinevirtual

Object cloning

Returns
A clone of this object

Implements active::utility::Cloner.

Here is the call graph for this function:

◆ concat()

Path & Path::concat ( const utility::String & toConcat)

Concatenates text to the path (without inserting a path separator - also use /=)

Parameters
toConcatThe string to concatenate to this path (as a directory node name - also use +=)
Returns
A reference to this
Here is the call graph for this function:
Here is the caller graph for this function:

◆ current()

Path Path::current ( )
static

Get the current path

Returns
The current path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

bool active::file::Path::empty ( ) const
inline

Determine if the path is empty

Returns
True if the path is empty

◆ getExtension()

String Path::getExtension ( ) const

Get the node name extension, e.g. "xml" (no dot)

Returns
The node name extension
Here is the call graph for this function:

◆ getNodeName()

String Path::getNodeName ( bool isExtensionDeleted = false) const

Get the name of the node (last name in the path)

Parameters
isExtensionDeletedTrue if the extension should be deleted
Returns
The name of the node
Here is the call graph for this function:

◆ hasFileName()

bool Path::hasFileName ( ) const

Determine if the path has a file name (if any name remains past the last '/')

Returns
True if the path has a file name

◆ lexicallyNormal()

Path active::file::Path::lexicallyNormal ( ) const
inline

Get a lexically normal path from this path (e.g. resolve ../ into the previous directory)

Returns
The lexically normal path

◆ operator const std::filesystem::path &()

active::file::Path::operator const std::filesystem::path & ( ) const
inline

Conversion operator

Returns
The path as a filesystem::path

◆ operator utility::String()

active::file::Path::operator utility::String ( ) const

Conversion operator

Returns
The path as a string
Here is the caller graph for this function:

◆ operator!=()

bool active::file::Path::operator!= ( const Path & ref) const
inline

Inequality operator

Parameters
refThe object to compare
Returns
True if ref is not identical to this

◆ operator+()

Path Path::operator+ ( const utility::String & toAppend) const

Addition operator

Parameters
toAppendThe string to append to this path (as a file node name)
Returns
The new path
Here is the call graph for this function:

◆ operator+=()

Path & active::file::Path::operator+= ( const utility::String & toConcat)
inline

Concatenate a name to the path (with a prefixed directory separator)

Parameters
toConcatThe string to concatenate to this path (with a directory separator)
Returns
A reference to this
Here is the call graph for this function:

◆ operator/()

Path active::file::Path::operator/ ( const utility::String & toAppend) const
inline

Create a path with a name appended to this path with a directory separator

Parameters
toAppendThe string to append to this path (with a directory separator)
Returns
The new path
Here is the call graph for this function:

◆ operator/=()

Path & active::file::Path::operator/= ( const utility::String & toAppend)
inline

Append a name to the path (with a prefixed directory separator)

Parameters
toAppendThe string to append to this path (with a directory separator)
Returns
A reference to this
Here is the call graph for this function:

◆ operator=()

Path & Path::operator= ( const Path & source)

Assignment operator

Parameters
sourceThe object to copy
Returns
A reference to this

◆ operator==()

bool Path::operator== ( const Path & ref) const

Equality operator

Parameters
refThe object to compare
Returns
True if ref is identical to this

◆ platformSpecific()

String Path::platformSpecific ( ) const

Get the path as a platform-specific string

Returns
The path as a platform-specific string
Here is the call graph for this function:

◆ relativePath()

Path active::file::Path::relativePath ( ) const
inline

Get a relative path (from the root directory)

Returns
The relative path

◆ removeFileName()

Path & Path::removeFileName ( )

Remove the filename component of the path (if any name remains past the last '/')

Returns
A reference to this
Here is the caller graph for this function:

◆ replaceExtension()

Path & Path::replaceExtension ( const utility::String & replacement = utility::String{})

Replace the file name extension

Parameters
replacementThe new extension (an emply string simply removes the extension)
Returns
A reference to this
Here is the call graph for this function:

◆ replaceFileName()

Path & Path::replaceFileName ( const utility::String & replacement = utility::String{})

Replace the file name

Parameters
replacementThe new name (an emply string simply removes the name)
Returns
A reference to this
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rootDirectory()

Path active::file::Path::rootDirectory ( ) const
inline

Get the path root directory

Returns
The path root directory path

◆ rootName()

Path active::file::Path::rootName ( ) const
inline

Get the path root name

Returns
The path root name

◆ rootPath()

Path active::file::Path::rootPath ( ) const
inline

Get the path root directory

Returns
The path root directory

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