sandbox
Loading...
Searching...
No Matches
filesystem_base.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_FILESYSTEM_FILESYSTEM_BASE_HPP_
3#define LIBSBX_FILESYSTEM_FILESYSTEM_BASE_HPP_
4
5#include <memory>
6#include <string>
7#include <vector>
8
9#include <libsbx/filesystem/file_base.hpp>
10#include <libsbx/filesystem/file_info.hpp>
11
12namespace sbx::filesystem {
13
15
16public:
17
18 using files_list = std::vector<file_info>;
19
20 filesystem_base() = default;
21
22 virtual ~filesystem_base() = default;
23
24 [[nodiscard]] virtual auto initialize() -> bool = 0;
25
26 virtual auto shutdown() -> void = 0;
27
28 [[nodiscard]] virtual auto is_initialized() const -> bool = 0;
29
30 [[nodiscard]] virtual auto base_path() const -> const std::string& = 0;
31
32 [[nodiscard]] virtual auto virtual_path() const -> const std::string& = 0;
33
34 [[nodiscard]] virtual auto files() const -> files_list = 0;
35
36 [[nodiscard]] virtual auto is_read_only() const -> bool = 0;
37
38 [[nodiscard]] virtual auto open_file(const std::string& path, const file_base::mode mode) -> file_ptr = 0;
39
40 virtual auto close_file(const file_ptr& file) -> void = 0;
41
42 [[nodiscard]] virtual auto create_file(const std::string& path) -> file_ptr = 0;
43
44 [[nodiscard]] virtual auto remove_file(const std::string& path) -> bool = 0;
45
46 [[nodiscard]] virtual auto copy_file(const std::string& source, const std::string& destination, const bool overwrite = false) -> bool = 0;
47
48 [[nodiscard]] virtual auto rename_file(const std::string& source, const std::string& destination) -> bool = 0;
49
50 [[nodiscard]] virtual auto exists(const std::string& path) const -> bool = 0;
51
52}; // class filesystem_base
53
54using filesystem_ptr = std::shared_ptr<filesystem_base>;
55using filesystem_weak_ptr = std::weak_ptr<filesystem_base>;
56
57} // namespace sbx::filesystem
58
59#endif // LIBSBX_FILESYSTEM_FILESYSTEM_BASE_HPP_
Definition: filesystem_base.hpp:14