CppCommon 1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
reader.h
Go to the documentation of this file.
1
9#ifndef CPPCOMMON_READER_H
10#define CPPCOMMON_READER_H
11
12#include <cstdint>
13#include <string>
14#include <vector>
15
16namespace CppCommon {
17
19
23class Reader
24{
25public:
26 Reader() noexcept = default;
27 Reader(const Reader&) noexcept = default;
28 Reader(Reader&&) noexcept = default;
29 virtual ~Reader() noexcept = default;
30
31 Reader& operator=(const Reader&) noexcept = default;
32 Reader& operator=(Reader&&) noexcept = default;
33
35
40 virtual size_t Read(void* buffer, size_t size) = 0;
41
43
46 std::vector<uint8_t> ReadAllBytes();
48
51 std::string ReadAllText();
53
56 std::vector<std::string> ReadAllLines();
57};
58
59} // namespace CppCommon
60
61#endif // CPPCOMMON_READER_H
Reader interface.
Definition reader.h:24
Reader() noexcept=default
std::vector< std::string > ReadAllLines()
Read all text lines.
Definition reader.cpp:38
std::vector< uint8_t > ReadAllBytes()
Read all bytes.
Definition reader.cpp:15
std::string ReadAllText()
Read all text.
Definition reader.cpp:32
virtual size_t Read(void *buffer, size_t size)=0
Read a bytes buffer base method.
C++ Common project definitions.