PUMA Library Reference Manual
Loading...
Searching...
No Matches
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.
 
 ~FilenameInfo ()
 Destructor.
 
void name (const char *filename)
 Set a new filename.
 
const char * name () const
 Get the filename.
 
const char * path ()
 Get the path portion of the filename.
 
const char * root ()
 Get the root of an absolute filename, i.e.
 
bool is_absolute () const
 Check whether the filename is absolute, i.e.
 
bool operator== (const FilenameInfo &filename) const
 Check if this filename equals the given.
 

Additional Inherited Members

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

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.