Uni/Stat#

Wrapper for the Unix stat C struct.

Info

To use declarations from this page, include the <essence/uni/stat.hpp> header. The declarations are found within the essence::uni namespace.

enum class filetype : i32#
enumerator regular = S_IFREG#
enumerator symlink = S_IFLNK#
enumerator directory = S_IFDIR#
enumerator socket = S_IFSOCK#
enumerator character = S_IFCHR#
enumerator block = S_IFBLK#
enumerator fifo = S_IFIFO#
enumerator unknown = 65535#
filetype detect_file(mode_t m)#

Detect the type of a file given its’ mode.

std::string filetype_string(filetype t)#

Get a string representation of the filetype t.

struct filetime#

Represents the time points associated with a file.

std::chrono::time_point<std::chrono::file_clock> access#
std::chrono::time_point<std::chrono::file_clock> modify#
std::chrono::time_point<std::chrono::file_clock> change#
struct owners#

Represents the owning user and group of a file.

gid_t gid#
uid_t uid#
std::string group#
std::string user#
bool chmod(std::string_view file, const mode &m)#

Applies mode m to file.

Parameter file may also be a std::string_view or const char*.

class status#

Wrapper around the stat C struct.

status::status(std::filesystem::path, bool follow = false)#

Constructor accepting a filesystem path, and a boolean determining whether or not to follow a potential symlink.

status::status(struct stat raw_stat)#

Constructor accepting a pre-populated stat struct

const struct stat &raw() const#

Getter for the underlying stat struct.

const mode &filemode() const#

Getter for the file permissions.

const filetype &type() const#

Getter for the file type.

const filetime &times() const#

Getter for the file times.

const struct owners &owners() const#

Getter for the file owners.

uid_t uid() const#

Getter for the user id.

gid_t gid() const#

Getter for the group id.

dev_t device() const#
dev_t special_device() const#
u32 special_device_major() const#
u32 special_device_minor() const#
usize size() const#
blkcnt_t blocks() const#
blksize_t blocksize() const#
std::string basename() const#
std::string stem() const#
std::string typestr() const#
enum class stx : u16#
enumerator none = 0#
enumerator size = STATX_SIZE#
enumerator all = STATX_ALL#
enumerator atime = STATX_ATIME#
enumerator basic = STATX_BASIC_STATS#
enumerator mtime = STATX_MTIME#
enumerator ctime = STATX_CTIME#
enumerator btime = STATX_BTIME#
enumerator blocks = STATX_BLOCKS#
enumerator group = STATX_GID#
enumerator user = STATX_UID#
enumerator ino = STATX_INO#
enumerator mode = STATX_MODE#
enumerator type = STATX_TYPE#
enumerator nlink = STATX_NLINK#
class statux#

Wrapper around statx for doing selective stat retrieval.

statux::statux(struct statx x)#

Constructor using a pre-populated statx struct.

statux::statux(std::string_view path, stx mask = stx::basic)#

Constructor accepting a path and mask bit-set.

std::chrono::time_point<std::chrono::file_clock> atime() const#

The time of the files’ last access.

std::chrono::time_point<std::chrono::file_clock> ctime() const#

The time of the files’ last access change (to its’ metadata).

std::chrono::time_point<std::chrono::file_clock> mtime() const#

The time of the files’ last modification (of its’ contents).

std::chrono::time_point<std::chrono::file_clock> btime() const#

The time of the files’ birth/creation.

const class owners &owners() const#

Information about the files’ ownership.

const class mode &filemode() const#

Information about the files’ permissions.

ino_t ino() const#

The files’ index node number.

nlink_t nlink() const#

The number of hard links pointing to the file.

enum filetype type() const#

The file type as a filetype member.

userid uid() const#

The UID of the file’s owner.

groupid gid() const#

The GID of the file’s group.

dev_t rdev() const#

If the file is a block or character special, this holds the device ID of said device.

dev_t dev() const#

The ID of the device containing the file.

usize size() const#

The file size in bytes.

u64 blocks() const#

The number of 512-byte blocks the file occupies.

u32 blocksize() const#

The preferred block size for filesystem I/O.