ChimeraTK-DeviceAccess  03.18.00
ChimeraTK::parserUtilities Namespace Reference

Functions

std::string getCurrentWorkingDirectory ()
 Returns absolute path to current working directory. The returned path ends with a forward slash. More...
 
std::string convertToAbsolutePath (std::string const &relativePath)
 Converts a relative path to its absolute path. More...
 
std::string extractDirectory (std::string const &path)
 Returns the path to the directory containing the file provided as the input parameter. More...
 
std::string extractFileName (std::string const &path)
 Extract the string after the last '/' in a path. Returned substring does not include the '/' character. More...
 
std::string concatenatePaths (const std::string &path1, const std::string &path2)
 Concatenates two given paths using custom rules. More...
 

Function Documentation

◆ concatenatePaths()

std::string ChimeraTK::parserUtilities::concatenatePaths ( const std::string &  path1,
const std::string &  path2 
)

Concatenates two given paths using custom rules.

Method returns path2 when input parameter path2 is an absolute path. Otherwise path1 is concatenated with path2 and returned.

Parameters
path1Path to a directory
path2Path to file/directory.
Returns
  • path2 when the input parameter, path2 is an absolute path.
  • path1 concatenated with path2 when path2 is a relative path.

Definition at line 27 of file parserUtilities.cc.

+ Here is the caller graph for this function:

◆ convertToAbsolutePath()

std::string ChimeraTK::parserUtilities::convertToAbsolutePath ( std::string const &  relativePath)

Converts a relative path to its absolute path.

Method converts a path relative to the programs current working directory to an absolute path. Providing an absolute path as parameter, still returns the absolute path.

Parameters
relativePathPath to a file/directory relative to the programs current working directory.
Returns
The absolute path to the file/directory, that had its relative path provided as the function parameter.

Definition at line 23 of file parserUtilities.cc.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractDirectory()

std::string ChimeraTK::parserUtilities::extractDirectory ( std::string const &  path)

Returns the path to the directory containing the file provided as the input parameter.

Parameters
pathPath to a file.
Returns
  • Path to the directory containing the file when the input is a path to a file. (i.e input parameter, path does not end in a '/')
  • Path to the directory when the input is a path to the directory. (i.e input parameter, path ends in a '/')

Definition at line 35 of file parserUtilities.cc.

+ Here is the caller graph for this function:

◆ extractFileName()

std::string ChimeraTK::parserUtilities::extractFileName ( std::string const &  path)

Extract the string after the last '/' in a path. Returned substring does not include the '/' character.

Parameters
pathString representing file path.
Returns
Substring containing characters after the last '/' in the input string. The '/' is excluded in this substring.

Definition at line 48 of file parserUtilities.cc.

+ Here is the caller graph for this function:

◆ getCurrentWorkingDirectory()

std::string ChimeraTK::parserUtilities::getCurrentWorkingDirectory ( )

Returns absolute path to current working directory. The returned path ends with a forward slash.

Returns
Current working directory of the program terminating in a forward slash.

Definition at line 19 of file parserUtilities.cc.

+ Here is the caller graph for this function: