SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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:

  • not Assignable
  • not Copy Constructible
  • not Comparable
Synopsis
#include <rw/stat.h>
Provides file statistical information in a portable manner.
Definition stat.h:44
Persistence
None

Member Typedef Documentation

◆ device_type

typedef dev_t RWFileStat::device_type

Type for the device number (integer).

◆ inode_type

typedef ino_t RWFileStat::inode_type

Type for the inode number (integer).

◆ mode_type [1/2]

typedef unsigned short RWFileStat::mode_type

Type for the mode.

Condition:
This type is used on Windows platforms.

◆ mode_type [2/2]

typedef mode_t RWFileStat::mode_type

Type for the mode.

Condition:
This type is used on non-Windows platforms.

◆ nlink_type [1/2]

typedef short RWFileStat::nlink_type

Type for the number of hard links.

Condition:
This type is used on Windows platforms.

◆ nlink_type [2/2]

typedef nlink_t RWFileStat::nlink_type

Type for the number of hard links.

Condition:
This type is used on non-Windows platforms.

◆ offset_type

typedef off_t RWFileStat::offset_type

Type for the offset (integer).

◆ stat_type [1/2]

typedef struct _stat RWFileStat::stat_type

Type of the underlying data structure.

Condition:
This type is used on Windows platforms.

◆ stat_type [2/2]

typedef struct stat RWFileStat::stat_type

Type of the underlying data structure.

Condition:
This type is used on non-Windows platforms.

Constructor & Destructor Documentation

◆ RWFileStat()

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

◆ atime()

time_t RWFileStat::atime ( ) const

Returns the time of the last access.

◆ ctime()

time_t RWFileStat::ctime ( ) const

Returns the time of the last status change.

◆ dev()

device_type RWFileStat::dev ( ) const

Returns the device number for the file.

◆ inode()

inode_type RWFileStat::inode ( ) const

Returns the inode number for the file.

◆ isBlock()

bool RWFileStat::isBlock ( ) const

Returns true if the file is a block device.

◆ isCharacter()

bool RWFileStat::isCharacter ( ) const

Returns true if the file is a character device.

◆ isDirectory()

bool RWFileStat::isDirectory ( ) const

Returns true if the file is a directory.

◆ isFifo()

bool RWFileStat::isFifo ( ) const

Returns true if the file is a FIFO named pipe.

◆ isFile()

bool RWFileStat::isFile ( ) const

Returns true if the file is a regular file.

◆ isSymlink()

bool RWFileStat::isSymlink ( ) const

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

◆ mode()

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.

◆ mtime()

time_t RWFileStat::mtime ( ) const

Returns the time of the last modification.

◆ nlink()

nlink_type RWFileStat::nlink ( ) const

Returns the number or hard links for the file.

◆ size()

offset_type RWFileStat::size ( ) const

Returns the size of the file.

◆ stat()

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.