zipios::FilePath Class Reference

FilePath represents a path to a file or directory name. More...

#include <filepath.h>

Public Member Functions

bool exists () const
 
FilePath filename () const
 Returns filename of the FilePath object by pruning the path off. More...
 
 FilePath (const string &path="", bool check_exists=false)
 Constructor. More...
 
bool isBlockSpecial () const
 
bool isCharSpecial () const
 
bool isDirectory () const
 
bool isFifo () const
 
bool isRegular () const
 
bool isSocket () const
 
 operator string () const
 
FilePath operator+ (const FilePath &name) const
 Concatenates FilePath objects. More...
 
FilePathoperator= (const string &rhs)
 

Protected Member Functions

void check () const
 This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is. More...
 
void pruneTrailingSeparator ()
 Prunes the trailing separator of a specified path. More...
 

Detailed Description

FilePath represents a path to a file or directory name.

FilePath has member functions to check if the file path is a valid file system entity, and to check what kind of file system entity it is, e.g. is it a file, a directory, a pipe etc.

Constructor & Destructor Documentation

◆ FilePath()

zipios::FilePath::FilePath ( const string &  path = "",
bool  check_exists = false 
)

Constructor.

Parameters
pathA string representation of the path.
check_existsIf true is specified the constructor will check the existence and type of the path immediately, instead of deferring that task until it is needed.

References exists(), and pruneTrailingSeparator().

Referenced by importIFClegacy.IfcWriter::write().

Member Function Documentation

◆ check()

void zipios::FilePath::check ( ) const
protected

This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is.

All the query functions check if _checked is true, and if it isn't they call check(). This means stat'ing is deferred until it becomes necessary.

Referenced by exists(), isBlockSpecial(), isCharSpecial(), isDirectory(), isFifo(), isRegular(), isSocket(), and femsolver.run.Machine::reset().

◆ exists()

bool zipios::FilePath::exists ( ) const
Returns
true If the path is a valid file system entity.

References check().

Referenced by FilePath().

◆ filename()

◆ isBlockSpecial()

bool zipios::FilePath::isBlockSpecial ( ) const
Returns
true if the path is block special (a block device file).

References check().

◆ isCharSpecial()

bool zipios::FilePath::isCharSpecial ( ) const
Returns
true if the path is character special (a character device file).

References check().

◆ isDirectory()

bool zipios::FilePath::isDirectory ( ) const
Returns
true if the path is a directory.

References check().

◆ isFifo()

bool zipios::FilePath::isFifo ( ) const
Returns
true if the path is a Fifo (a pipe).

References check().

◆ isRegular()

bool zipios::FilePath::isRegular ( ) const
Returns
true if the path is a regular file.

References check().

◆ isSocket()

bool zipios::FilePath::isSocket ( ) const
Returns
true if the path is a socket.

References check().

◆ operator string()

zipios::FilePath::operator string ( ) const

◆ operator+()

FilePath zipios::FilePath::operator+ ( const FilePath name) const

Concatenates FilePath objects.

A file separator is inserted if appropriate.

◆ operator=()

FilePath & zipios::FilePath::operator= ( const string &  rhs)

◆ pruneTrailingSeparator()

void zipios::FilePath::pruneTrailingSeparator ( )
protected

Prunes the trailing separator of a specified path.

Referenced by FilePath(), and operator=().


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