Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
filesystem.h
Go to the documentation of this file.
1
5#ifndef HAM_FILESYSTEM_HPP
6#define HAM_FILESYSTEM_HPP
7
8#include <cstddef>
9#include <cstdint>
10
11#include <memory>
12
13namespace lampda {
14namespace hal {
16namespace filesystem {
17
19class FileInternalTy;
20
22extern void shutdown();
23
25extern void format_file_system();
26
28extern bool delete_file(const char* fname);
29
32{
33 HAL_File();
34 ~HAL_File();
35
36 enum class OpenType
37 {
38 READ,
39 WRITE,
40 };
41
42 bool open(const char* fname, const OpenType& mode);
43
44 bool is_open() const;
45
46 bool is_available() const;
47
48 void close();
49
50 size_t size() const;
51
52 size_t write(const uint8_t* const in, size_t sz);
53
54 size_t read(uint8_t* out, size_t sz);
55
56 bool seek(uint8_t sz);
57
58 void truncate(uint8_t sz);
59
60 // operator bool() const;
61
62private:
63 std::unique_ptr<FileInternalTy> mInternalFile;
64};
65
66} // namespace filesystem
67} // namespace hal
68} // namespace lampda
69
70#endif
void shutdown()
Global filesystem shutdown.
void format_file_system()
Format/erase the whole file system.
bool delete_file(const char *fname)
Delete a given file.
Program scope.
Definition: control_fixed_modes.hpp:12
Handle class for a file.
Definition: filesystem.h:32