libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
info.hpp
1#pragma once
2
3#include "../core/sizable.hpp"
4#include "../core/string.hpp"
5#include <sys/stat.h>
6
7#ifdef _WIN32
8#elif __linux__
9#define _stat stat
10#else
11#error file::info is incompatible with this OS! Please create a pull request or open an issue on GitHub.
12#endif
13
14namespace z {
15namespace file {
27private:
28 struct _stat fileStat;
29 bool does_exist;
30
31public:
38 info(const zpath &path) noexcept;
39
48 bool exists() const noexcept;
49
56 time_t accessed() const noexcept;
57
64 time_t modified() const noexcept;
65
72 time_t changed() const noexcept;
73
80 size_t size() const noexcept override;
81
88 int device() const noexcept;
89
94 mode_t mode() const noexcept;
95
100 bool directory() const noexcept;
101
106 bool symlink() const noexcept;
107
112 bool regular() const noexcept;
113};
114} // namespace file
115} // namespace z
An interface for getting an object's size.
Definition sizable.hpp:13
A class to allow a platform-independent way to get information on a file.
Definition info.hpp:26
time_t modified() const noexcept
Get the time that the file was last modified.
bool directory() const noexcept
Check if this file is a directory.
int device() const noexcept
Get the number of the device where the file is stored.
bool regular() const noexcept
Check if this file is a regular file.
bool exists() const noexcept
Get whether the file object exists and can be accessed.
time_t changed() const noexcept
Get the time that the file's status was last changed.
bool symlink() const noexcept
Check if this file is a symbolic link.
size_t size() const noexcept override
Get the size of the file.
mode_t mode() const noexcept
Get the mode (permissions) of the file.
time_t accessed() const noexcept
Get the time that the file was last accessed.
info(const zpath &path) noexcept
Constructor with file path.
zpath path(const zpath &filePath) noexcept
Get the full file path from a relative path.