PUMA Library Reference Manual
Puma::FilenameInfo Class Reference

#include <Puma/FilenameInfo.h>

+ Inheritance diagram for Puma::FilenameInfo:

Description

Information about a filename supporting Puma::SmartPtr. This object stores the name of the file, its path portion, and the root portion if the filename is absolute.

Public Member Functions

 FilenameInfo ()
 Constructor. More...
 
 ~FilenameInfo ()
 Destructor. More...
 
void name (const char *filename)
 Set a new filename. More...
 
const char * name () const
 Get the filename. More...
 
const char * path ()
 Get the path portion of the filename. More...
 
const char * root ()
 Get the root of an absolute filename, i.e. More...
 
bool is_absolute () const
 Check whether the filename is absolute, i.e. More...
 
bool operator== (const FilenameInfo &filename) const
 Check if this filename equals the given. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Puma::SmartPtr< T >::RefCnt
 RefCnt ()
 Constructor. More...
 

Constructor & Destructor Documentation

◆ FilenameInfo()

Puma::FilenameInfo::FilenameInfo ( )
inline

Constructor.

◆ ~FilenameInfo()

Puma::FilenameInfo::~FilenameInfo ( )

Destructor.

Frees the allocated strings.

Member Function Documentation

◆ is_absolute()

bool Puma::FilenameInfo::is_absolute ( ) const

Check whether the filename is absolute, i.e.

starts at the root of the file system.

Returns
True if the filename is absolute.

◆ name() [1/2]

const char* Puma::FilenameInfo::name ( ) const
inline

Get the filename.

Returns
The filename.

◆ name() [2/2]

void Puma::FilenameInfo::name ( const char *  filename)

Set a new filename.

Parameters
filenameThe new filename.

◆ operator==()

bool Puma::FilenameInfo::operator== ( const FilenameInfo filename) const
inline

Check if this filename equals the given.

Parameters
filenameThe other filename.
Returns
True if both filenames are equal.

◆ path()

const char* Puma::FilenameInfo::path ( )

Get the path portion of the filename.

Returns
The path to the file.

◆ root()

const char* Puma::FilenameInfo::root ( )

Get the root of an absolute filename, i.e.

everything up to the first path delimiter. This is for instance the drive portion of the filename on Windows (c:). On Unix systems this is simply a slash (/).

Returns
The root or NULL if filename is not absolute.