NAME
OTC_Stat -
Class wrapper around the system stat structure.
SYNOPSIS
#include <OTC/files/stat.hh>
class OTC_Stat
{
public:
static os_typespec* get_os_typespec();
inline operator otclib_stat*();
OTC_Stat();
OTC_Stat(OTC_Stat const& theStat);
OTC_Stat& operator=(OTC_Stat const& theStat);
inline dev_t dev() const;
inline u_short mode() const;
inline u_short permissions() const;
inline u_short type() const;
inline off_t size() const;
inline time_t atime() const;
inline time_t mtime() const;
inline time_t ctime() const;
inline OTC_Boolean isDirectory() const;
inline OTC_Boolean isRegularFile() const;
inline OTC_Boolean isCharacterSpecial() const;
inline OTC_Boolean isFifo() const;
inline OTC_Boolean isBlockSpecial() const;
inline OTC_Boolean isUserRead() const;
inline OTC_Boolean isUserWrite() const;
inline OTC_Boolean isUserExec() const;
protected:
otclib_stat myStat;
};
CLASS TYPE
Concrete
EXAMPLE
OTC_Stat info;
if (stat("/tmp",info) == 0)
{
if (info.isDirectory())
cout << "Is a directory" << endl;
}
ATTRIBUTES
inline dev_t dev() const;
Returns the device id for device which
the file resides upon.
inline u_short mode() const;
Returns the files mode bits.
inline u_short permissions() const;
Returns the bits of the mode
giving the file permissions.
inline u_short type() const;
Returns the bits of the mode
giving the file type.
inline off_t size() const;
Returns the size of the file.
inline time_t atime() const;
Returns the last access time of the file.
inline time_t mtime() const;
Returns the last modification time of the
file.
inline time_t ctime() const;
Returns the last time which the status of
the file was changed.
The following simplify questions commonly asked about files.
inline OTC_Boolean isDirectory() const;
Returns OTCLIB_TRUE if file is a
directory.
inline OTC_Boolean isRegularFile() const;
Returns OTCLIB_TRUE if file is a regular
file.
inline OTC_Boolean isCharacterSpecial() const;
Returns OTCLIB_TRUE if file is a character
special file.
inline OTC_Boolean isFifo() const;
Returns OTCLIB_TRUE if file is a fifo.
inline OTC_Boolean isBlockSpecial() const;
Returns OTCLIB_TRUE if file is a block
special file.
inline OTC_Boolean isUserRead() const;
Returns OTCLIB_FALSE if not readable by
the user who owns the file.
inline OTC_Boolean isUserWrite() const;
Returns OTCLIB_FALSE if not writable by
the user who owns the file.
inline OTC_Boolean isUserExec() const;
Returns OTCLIB_FALSE if not executable
by the user who owns the file.
DECSCRIPTION
Encapsulates the system stat structure to make deriving information
about a file easier. Note that it is still necessary to use the
system stat() function to fill out information in the class.
SEE ALSO
stat(2)
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 1992 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED