#include <OTC/files/pathname.hh> class OTC_Pathname : public OTC_SObject {
public:
static os_typespec* get_os_typespec();
~OTC_Pathname();
OTC_Pathname();
OTC_Pathname(char const* thePath);
OTC_Pathname(OTC_String const& thePath);
OTC_Pathname(OTC_Pathname const& thePath);
inline OTC_Pathname& operator=(OTC_Pathname const& thePath);
inline OTC_Pathname& operator=(OTC_String const& thePath);
inline OTC_String const& path() const;
inline operator char const*() const;
OTC_Boolean isAccessable() const;
OTC_Boolean isWritable() const;
OTC_Boolean isReadable() const;
OTC_Boolean isExecutable() const;
inline OTC_Pathname& operator+=(char theChar);
inline OTC_Pathname& operator+=(char const* theString);
inline OTC_Pathname& operator+=(OTC_String const& theString);
inline OTC_Pathname& operator+=(OTC_Pathname const& thePath);
inline OTC_TString operator+(char theChar);
inline OTC_TString operator+(char const* theString);
inline OTC_TString operator+(OTC_String const& theString);
inline OTC_TString operator+(OTC_Pathname const& thePath);
protected:
OTC_RString rawString() const;
};
OTC_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.
OTC_Pathname();
OTC_Pathname(char const* thePath);
thePath
.
OTC_Pathname(OTC_String const& thePath);
thePath
.
OTC_Pathname(OTC_Pathname const& thePath);
thePath
.
inline OTC_Pathname& operator=(OTC_Pathname const& thePath);
thePath
.
inline OTC_Pathname& operator=(OTC_String const& thePath);
thePath
.
inline OTC_String const& path() const;
inline operator char const*() const;
OTC_Boolean isAccessable() const;
OTCLIB_TRUE
if the file exists
and all directories in the path are
searchable. In the case of OTCLIB_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.
OTC_Boolean isWritable() const;
OTCLIB_TRUE
if the file is
writable.
OTC_Boolean isReadable() const;
OTCLIB_TRUE
if the file is
readable.
OTC_Boolean isExecutable() const;
OTCLIB_TRUE
if the file is
executable.
inline OTC_Pathname& operator+=(char theChar);
theChar
.
inline OTC_Pathname& operator+=(char const* theString);
theString
.
inline OTC_Pathname& operator+=(OTC_String const& theString);
theString
.
inline OTC_Pathname& operator+=(OTC_Pathname const& thePath);
thePath
.
inline OTC_TString operator+(char theChar);
theChar
appended.
This object is not modified.
inline OTC_TString operator+(char const* theString);
theString
appended.
This object is not modified.
inline OTC_TString operator+(OTC_String const& theString);
theString
appended.
This object is not modified.
inline OTC_TString operator+(OTC_Pathname const& thePath);
thePath
appended.
This object is not modified.
operator<<()
and operator>>()
are overloaded for operation
with streams. The extraction operator behaves the same as that for the
OTC_String
class, namely it will extract up to the first whitespace
character in the input. Also, if ios::skipws
is defined it will first
skip leading whitespace.
OTC_String::trim()
.
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.
An OTC_BaseActions
and OTC_HashActions
class are defined for
OTC_Pathname
.
access(2)
, dirname(1)
, basename(1)