libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
z::file::info Class Reference

A class to allow a platform-independent way to get information on a file. More...

#include <info.hpp>

Inheritance diagram for z::file::info:
z::core::sizable

Public Member Functions

 info (const zpath &path) noexcept
 Constructor with file path.
 
bool exists () const noexcept
 Get whether the file object exists and can be accessed.
 
time_t accessed () const noexcept
 Get the time that the file was last accessed.
 
time_t modified () const noexcept
 Get the time that the file was last modified.
 
time_t changed () const noexcept
 Get the time that the file's status was last changed.
 
size_t size () const noexcept override
 Get the size of the file.
 
int device () const noexcept
 Get the number of the device where the file is stored.
 
mode_t mode () const noexcept
 Get the mode (permissions) of the file.
 
bool directory () const noexcept
 Check if this file is a directory.
 
bool symlink () const noexcept
 Check if this file is a symbolic link.
 
bool regular () const noexcept
 Check if this file is a regular file.
 

Detailed Description

A class to allow a platform-independent way to get information on a file.

As not all Linux file system options have a Windows analog, this class is not a full wrapper for the stat struct. It does however allow for retrieval of the most common file information (e.g. file size, modification date, etc).

Constructor & Destructor Documentation

◆ info()

z::file::info::info ( const zpath path)
noexcept

Constructor with file path.

Parameters
patha string of the path to the file object.

Member Function Documentation

◆ accessed()

time_t z::file::info::accessed ( ) const
noexcept

Get the time that the file was last accessed.

Returns
When the file was last accessed, if it exists. 0 otherwise.

◆ changed()

time_t z::file::info::changed ( ) const
noexcept

Get the time that the file's status was last changed.

Returns
When the file status was last changed, if it exists. 0 otherwise.

◆ device()

int z::file::info::device ( ) const
noexcept

Get the number of the device where the file is stored.

Returns
The device number of the file, if it exists. 0 otherwise.

◆ directory()

bool z::file::info::directory ( ) const
noexcept

Check if this file is a directory.

Returns
True if this is a directory, false otherwise.

◆ exists()

bool z::file::info::exists ( ) const
noexcept

Get whether the file object exists and can be accessed.

Returns
False if the file does not exist or cannot be accessed for some reason. True otherwise.

◆ mode()

mode_t z::file::info::mode ( ) const
noexcept

Get the mode (permissions) of the file.

Returns
The file permissions.

◆ modified()

time_t z::file::info::modified ( ) const
noexcept

Get the time that the file was last modified.

Returns
When the file was last modified, if it exists. 0 otherwise.

◆ regular()

bool z::file::info::regular ( ) const
noexcept

Check if this file is a regular file.

Returns
True if this is a file, false otherwise.

◆ size()

size_t z::file::info::size ( ) const
overridevirtualnoexcept

Get the size of the file.

Returns
The size of the file (in Bytes), if it exists. 0 otherwise.

Implements z::core::sizable.

◆ symlink()

bool z::file::info::symlink ( ) const
noexcept

Check if this file is a symbolic link.

Returns
True if this is a symlink, false otherwise.

The documentation for this class was generated from the following file: