SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Types | Public Member Functions
RWFileStat Struct Reference

Provides file statistical information in a portable manner. More...

#include <rw/stat.h>

Public Types

typedef dev_t device_type
 
typedef ino_t inode_type
 
typedef unsigned short mode_type
 
typedef mode_t mode_type
 
typedef short nlink_type
 
typedef nlink_t nlink_type
 
typedef off_t offset_type
 
typedef struct stat stat_type
 
typedef struct _stat stat_type
 

Public Member Functions

 RWFileStat (const char *s, bool follow_links=true)
 
time_t atime () const
 
time_t ctime () const
 
device_type dev () const
 
inode_type inode () const
 
bool isBlock () const
 
bool isCharacter () const
 
bool isDirectory () const
 
bool isFifo () const
 
bool isFile () const
 
bool isSymlink () const
 
mode_type mode () const
 
time_t mtime () const
 
nlink_type nlink () const
 
offset_type size () const
 
const stat_typestat () const
 

Detailed Description

The class RWFileStat provides file statistical information in a portable manner. RWFileStat is:

Synopsis
#include <rw/stat.h>
Persistence
None

Member Typedef Documentation

typedef dev_t RWFileStat::device_type

Type for the device number (integer).

typedef ino_t RWFileStat::inode_type

Type for the inode number (integer).

typedef unsigned short RWFileStat::mode_type

Type for the mode.

Condition:
This type is used on Windows platforms.
typedef mode_t RWFileStat::mode_type

Type for the mode.

Condition:
This type is used on non-Windows platforms.
typedef short RWFileStat::nlink_type

Type for the number of hard links.

Condition:
This type is used on Windows platforms.
typedef nlink_t RWFileStat::nlink_type

Type for the number of hard links.

Condition:
This type is used on non-Windows platforms.
typedef off_t RWFileStat::offset_type

Type for the offset (integer).

typedef struct stat RWFileStat::stat_type

Type of the underlying data structure.

Condition:
This type is used on non-Windows platforms.
typedef struct _stat RWFileStat::stat_type

Type of the underlying data structure.

Condition:
This type is used on Windows platforms.

Constructor & Destructor Documentation

RWFileStat::RWFileStat ( const char *  s,
bool  follow_links = true 
)
explicit

Constructs the object by using a stat function on the filename given in s. The call succeeds or throws an exception of type (or derived of) RWInternalErr . The error can be inspected by looking at errno. If the filename indicates a symbolic link, it uses a stat function on the target of the symbolic link rather than the symbolic link itself when the parameter follow_links is true (default). Otherwise, it uses a stat function on the symbolic link.

Member Function Documentation

time_t RWFileStat::atime ( ) const

Returns the time of the last access.

time_t RWFileStat::ctime ( ) const

Returns the time of the last status change.

device_type RWFileStat::dev ( ) const

Returns the device number for the file.

inode_type RWFileStat::inode ( ) const

Returns the inode number for the file.

bool RWFileStat::isBlock ( ) const

Returns true if the file is a block device.

bool RWFileStat::isCharacter ( ) const

Returns true if the file is a character device.

bool RWFileStat::isDirectory ( ) const

Returns true if the file is a directory.

bool RWFileStat::isFifo ( ) const

Returns true if the file is a FIFO named pipe.

bool RWFileStat::isFile ( ) const

Returns true if the file is a regular file.

bool RWFileStat::isSymlink ( ) const

Returns true if the file is a symlink. This member function always returns false for objects of type RWFileStat.

mode_type RWFileStat::mode ( ) const

Returns an integer which is a bit mask value indicating the type of the file and the permissions for it.

time_t RWFileStat::mtime ( ) const

Returns the time of the last modification.

nlink_type RWFileStat::nlink ( ) const

Returns the number or hard links for the file.

offset_type RWFileStat::size ( ) const

Returns the size of the file.

const stat_type* RWFileStat::stat ( ) const

Returns a pointer to the underlying type. The type is a struct stat but it may change in the future. Using the returned type directly is not supported.

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.