ReXGlue SDK
Loading...
Searching...
No Matches
file_stat.h
Go to the documentation of this file.
1
10
11#pragma once
12
13#include <optional>
14#include <string>
15
16#include <rex/bit.h>
17#include <rex/types.h>
18
19namespace rex::filesystem {
20
21using rex::HasFlags;
22using rex::operator|;
23using rex::operator&;
24using rex::operator^;
25using rex::operator~;
26using rex::operator|=;
27using rex::operator&=;
28using rex::operator^=;
29
31enum class FileAttributes : u16 {
32 kNone = 0x0000,
33 kReadOnly = 0x0001,
34 kHidden = 0x0002,
35 kSystem = 0x0004,
36 kDirectory = 0x0010,
37 kArchive = 0x0020,
38 kDevice = 0x0040,
39 kNormal = 0x0080,
40 kTemporary = 0x0100,
41 kCompressed = 0x0800,
42 kEncrypted = 0x4000,
43};
44
45struct FileStat {
46 std::string name;
47 std::string path;
48 std::string absolute_path;
49 FileAttributes attributes = FileAttributes::kNone;
50 u64 size = 0;
52 u64 create_time = 0;
53 u64 access_time = 0;
54 u64 write_time = 0;
55};
56
57inline constexpr u32 kBytesPerSector = 0x200;
58
60struct FileTimes {
61 // NOLINTNEXTLINE(readability-redundant-member-init): designated initializers omit this field
62 std::optional<u64> create = {};
63 // NOLINTNEXTLINE(readability-redundant-member-init): designated initializers omit this field
64 std::optional<u64> access = {};
65 std::optional<u64> write;
66};
67
68struct VolumeStat {
69 std::string name;
70 u32 attributes = 0;
71 u32 component_name_max_length = 0;
72 u32 total_allocation_units = 0;
73 u32 available_allocation_units = 0;
74 u32 sectors_per_allocation_unit = 0;
75 u32 bytes_per_sector = 0;
76};
77
78} // namespace rex::filesystem
79
80template <>
FileAttributes
Definition file_stat.h:31
@ kNormal
Definition file_stat.h:39
constexpr bool is_flags_enum
Definition bit.h:422
constexpr bool HasFlags(E value, E flags)
Definition bit.h:483
Definition file_stat.h:45
std::string name
Definition file_stat.h:46
std::string path
Definition file_stat.h:47
u64 access_time
Definition file_stat.h:53
u64 write_time
Definition file_stat.h:54
u64 allocation_size
Definition file_stat.h:51
std::string absolute_path
Definition file_stat.h:48
u64 create_time
Definition file_stat.h:52
Definition file_stat.h:60
std::optional< u64 > create
Definition file_stat.h:62
std::optional< u64 > access
Definition file_stat.h:64
std::optional< u64 > write
Definition file_stat.h:65
Definition file_stat.h:68
u32 attributes
Definition file_stat.h:70
std::string name
Definition file_stat.h:69
Integer types, byte order wrappers and size literals.