Kea 2.7.0
isc::util::file::Path Struct Reference

Paths on a filesystem. More...

#include <filesystem.h>

Public Member Functions

 Path (std::string const &path)
 Constructor.
 
std::string extension () const
 Get the extension of the file.
 
std::string filename () const
 Get the name of the file, extension included.
 
std::string parentPath () const
 Get the parent path.
 
PathreplaceExtension (std::string const &replacement=std::string())
 Identifies the extension in {replacement}, trims it, and replaces this instance's extension with it.
 
PathreplaceParentPath (std::string const &replacement=std::string())
 Trims {replacement} and replaces this instance's parent path with it.
 
std::string stem () const
 Get the base name of the file without the extension.
 
std::string str () const
 Get the path in textual format.
 

Detailed Description

Paths on a filesystem.

Definition at line 52 of file filesystem.h.

Constructor & Destructor Documentation

◆ Path()

isc::util::file::Path::Path ( std::string const & path)

Constructor.

Splits the full name into components.

Definition at line 72 of file filesystem.cc.

Member Function Documentation

◆ extension()

string isc::util::file::Path::extension ( ) const

Get the extension of the file.

Counterpart for std::filesystem::path::extension.

Returns
extension of current path.

Definition at line 129 of file filesystem.cc.

Referenced by sentinel().

◆ filename()

string isc::util::file::Path::filename ( ) const

Get the name of the file, extension included.

Counterpart for std::filesystem::path::filename.

Returns
name + extension of current path.

Definition at line 134 of file filesystem.cc.

◆ parentPath()

string isc::util::file::Path::parentPath ( ) const

Get the parent path.

Counterpart for std::filesystem::path::parent_path.

Returns
parent path of current path.

Definition at line 119 of file filesystem.cc.

◆ replaceExtension()

Path & isc::util::file::Path::replaceExtension ( std::string const & replacement = std::string())

Identifies the extension in {replacement}, trims it, and replaces this instance's extension with it.

Counterpart for std::filesystem::path::replace_extension.

The change is done in the members and {this} is returned to allow call chaining.

Parameters
replacementThe extension to replace with.
Returns
The current instance after the replacement was done.

Definition at line 139 of file filesystem.cc.

References isc::util::str::trim().

+ Here is the call graph for this function:

◆ replaceParentPath()

Path & isc::util::file::Path::replaceParentPath ( std::string const & replacement = std::string())

Trims {replacement} and replaces this instance's parent path with it.

The change is done in the members and {this} is returned to allow call chaining.

Parameters
replacementThe parent path to replace with.
Returns
The current instance after the replacement was done.

Definition at line 155 of file filesystem.cc.

References isc::util::str::trim().

+ Here is the call graph for this function:

◆ stem()

string isc::util::file::Path::stem ( ) const

Get the base name of the file without the extension.

Counterpart for std::filesystem::path::stem.

Returns
the base name of current path without the extension.

Definition at line 124 of file filesystem.cc.

Referenced by isc::process::Daemon::checkConfigFile(), isc::process::Daemon::makePIDFileName(), and sentinel().

◆ str()

string isc::util::file::Path::str ( ) const

Get the path in textual format.

Counterpart for std::filesystem::path::string.

Returns
stored filename.

Definition at line 114 of file filesystem.cc.


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