DotNameLib
Loading...
Searching...
No Matches
IFileReader.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <cstdint>
5#include <filesystem>
6#include <string>
7#include <vector>
8
9namespace dotnamecpp::utils {
10
18 public:
19 virtual ~IFileReader() = default;
20
27 [[nodiscard]]
28 virtual Result<std::string, FileError> read(const std::filesystem::path &filePath) const = 0;
29
36 [[nodiscard]]
38 readBytes(const std::filesystem::path &filePath) const = 0;
39
46 [[nodiscard]]
48 readLines(const std::filesystem::path &filePath) const = 0;
49
57 [[nodiscard]]
58 virtual bool exists(const std::filesystem::path &filePath) const = 0;
59
66 [[nodiscard]]
68 getSize(const std::filesystem::path &filePath) const = 0;
69 };
70
71} // namespace dotnamecpp::utils
Interface for reading file content.
Definition IFileReader.hpp:17
virtual Result< std::vector< uint8_t >, FileError > readBytes(const std::filesystem::path &filePath) const =0
Read the entire content of a file as a vector of bytes.
virtual bool exists(const std::filesystem::path &filePath) const =0
Check if a file exists.
virtual Result< std::uintmax_t, FileError > getSize(const std::filesystem::path &filePath) const =0
Get the Size object.
virtual Result< std::vector< std::string >, FileError > readLines(const std::filesystem::path &filePath) const =0
Read the content of a file as a vector of lines.
virtual Result< std::string, FileError > read(const std::filesystem::path &filePath) const =0
Read the entire content of a file as a string.
virtual ~IFileReader()=default
Definition UtilsError.hpp:93
Definition DirectoryManager.cpp:5
Definition UtilsError.hpp:35