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 permission#

Represents the three access permission bits for a file.

bool read{false}#
bool write{false}#
bool exec{false}#
class permissions#

Represents permissions for the owner, group and others along with the setuid, setgid and sticky bits.

permission owner#
permission group#
permission other#
bool setuid{false}#
bool setgid{false}#
bool sticky{false}#
std::string octal() const#

Return an octal string representation of the permissions.

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#
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 permissions &perms() 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#