SourceForge.net Logo
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

EkPathname Class Reference

Provides the functionality one would desire when working with file paths. More...

#include <EkPathname.h>

Inheritance diagram for EkPathname:

[legend]
Collaboration diagram for EkPathname:
[legend]
List of all members.

Public Methods

 EkPathname ()
 This is the default constructor. More...

 EkPathname (const EkPathChar *thePath)
 This creates a pathname from a c-<SPmtString>. More...

 EkPathname (const EkPathString &thePath)
 This creates a pathname from a c++ <SPmtString>. More...

 EkPathname (const EkPathname &thePath)
 This is the copy constructor. More...

 ~EkPathname ()
 This is the destructor. More...

EkPathname & operator= (const EkPathname &thePath)
 This is an assignment operator that takes another EkPathname. More...

EkPathname & operator= (const EkPathString &thePath)
 This is an assignment operator that takes a c++ <SPmtString>. More...

EkPathname & operator= (const EkPathChar *theString)
EkPathname & operator+= (EkPathChar theChar)
 Extension operator- this adds a character to the pathname. More...

EkPathname & operator+= (const EkPathChar *theString)
 Extension operator- this adds a SPmtString of characters to the pathname. More...

EkPathname & operator+= (const EkPathString &theString)
 Extension operator- this adds a SPmtString to the pathname. More...

EkPathname & operator+= (const EkPathname &thePath)
 Extension operator- this adds another pathname to the pathname. More...

 operator const EkPathChar * () const
 Returns the const char pointer to the c-SPmtString holding the pathname. More...

EkPathString operator+ (const EkPathname &thePath)
 Appends a pathname to the current pathname. This does not modify the EkPathname object. More...

bool isAccessable () const
 Checks to see if the file exists and all directories are searchable. More...

bool isDirectory () const
 Returns TRUE if the path is a directory. More...

bool isExecutable () const
 Returns TRUE if the file / directory is executable. More...

bool isReadable () const
 Returns TRUE if the file / directory is readable. More...

bool isWritable () const
 Returns TRUE if the file / directory is writable. More...

EkPathname absolute () const
 Returns the pathname as an absolute path. More...

EkPathname basename () const
 Behaves like basename(1), returning the filename portion of the pathname. More...

EkPathString basename (const EkPathChar *theSuffix) const
 Returns the filename portion of the pathname, less theSuffix, if the file did in fact end in that suffix. More...

EkPathname dirname () const
 Behaves like dirname(1), returning the directory portion of the pathname. More...

void tempName ()
 Installs a unique temporary file path/name into the current instance. More...

Path Type Check
Note that if the pathname is empty both isAbsolute() and isRelative() will return FALSE.

bool isAbsolute () const
 Returns TRUE if the pathname is absolute - this is determined by checking for a leading "/". More...

bool isRelative () const
 Returns TRUE if the pathname is relative - this is determined by checking for a leading "./". More...


Detailed Description

Provides the functionality one would desire when working with file paths.

The Pathname class is intended to hold the pathname of a file and allow interogation of whether or not the file exists and what access the user is allowed. Trailing and leading whitespace is not removed from the pathname by this class. The functions isAccessable(), isReadable(), isWritable() and isExecutable() make use of access(1). Thus the results generated are based on the real user ID and supplementary group ID (including the real group ID) of the executing program.


Constructor & Destructor Documentation

EkPathname::EkPathname   [inline]
 

This is the default constructor.

EkPathname::EkPathname const EkPathChar   thePath [inline]
 

This creates a pathname from a c-<SPmtString>.

EkPathname::EkPathname const EkPathString   thePath [inline]
 

This creates a pathname from a c++ <SPmtString>.

EkPathname::EkPathname const EkPathname &    thePath [inline]
 

This is the copy constructor.

EkPathname::~EkPathname   [inline]
 

This is the destructor.


Member Function Documentation

EkPathname EkPathname::absolute   const
 

Returns the pathname as an absolute path.

If the path was already absolute then it is returned, unchanged. If it was relative, the current working directory is prepended to it and the result returned. In the case of the pathname being ".", the current working directory is returned without a trailing "/.". If the pathname is empty, an empty pathname is returned.

EkPathString EkPathname::basename const EkPathChar   theSuffix const
 

Returns the filename portion of the pathname, less theSuffix, if the file did in fact end in that suffix.

EkPathname EkPathname::basename   const
 

Behaves like basename(1), returning the filename portion of the pathname.

EkPathname EkPathname::dirname   const
 

Behaves like dirname(1), returning the directory portion of the pathname.

bool EkPathname::isAbsolute   const
 

Returns TRUE if the pathname is absolute - this is determined by checking for a leading "/".

bool EkPathname::isAccessable   const
 

Checks to see if the file exists and all directories are searchable.

Returns TRUE if the file exists and all directories in the path are searchable. In the case of FALSE being returned, if errno is ENOENT then the file truly doesn't exist. If errno has some other value, then a problem was encountered in accessing the file.

bool EkPathname::isDirectory   const
 

Returns TRUE if the path is a directory.

bool EkPathname::isExecutable   const
 

Returns TRUE if the file / directory is executable.

bool EkPathname::isReadable   const
 

Returns TRUE if the file / directory is readable.

bool EkPathname::isRelative   const
 

Returns TRUE if the pathname is relative - this is determined by checking for a leading "./".

bool EkPathname::isWritable   const
 

Returns TRUE if the file / directory is writable.

EkPathname::operator const EkPathChar *   const [inline]
 

Returns the const char pointer to the c-SPmtString holding the pathname.

EkPathString EkPathname::operator+ const EkPathname &    thePath [inline]
 

Appends a pathname to the current pathname. This does not modify the EkPathname object.

EkPathname& EkPathname::operator+= const EkPathname &    thePath [inline]
 

Extension operator- this adds another pathname to the pathname.

EkPathname& EkPathname::operator+= const EkPathString   theString [inline]
 

Extension operator- this adds a SPmtString to the pathname.

EkPathname& EkPathname::operator+= const EkPathChar   theString [inline]
 

Extension operator- this adds a SPmtString of characters to the pathname.

EkPathname& EkPathname::operator+= EkPathChar    theChar [inline]
 

Extension operator- this adds a character to the pathname.

EkPathname& EkPathname::operator= const EkPathChar   theString [inline]
 

EkPathname& EkPathname::operator= const EkPathString   thePath [inline]
 

This is an assignment operator that takes a c++ <SPmtString>.

EkPathname& EkPathname::operator= const EkPathname &    thePath [inline]
 

This is an assignment operator that takes another EkPathname.

void EkPathname::tempName  
 

Installs a unique temporary file path/name into the current instance.


The documentation for this class was generated from the following files:
Last Updated: March 12, 2003 (rlr)
Copyright © 2003 Eastman Kodak Company All Rights Reserved.