23#include <fmt/ostream.h>
24#include <nlohmann/json.hpp>
25using json = nlohmann::json;
70 GuiResult guiConfig(
const char* vFilters,
const std::vector<std::string>& extensions,
size_t id,
const std::string& nameId);
106 return std::getline(_filestream, str);
113 auto readsome(
char* s, std::streamsize count) {
return _filestream.readsome(s, count); }
120 auto&
read(
char* __s, std::streamsize __n) {
return _filestream.read(__s, __n); }
126 auto&
ignore(std::streamsize count,
int delim) {
return _filestream.ignore(count, delim); }
133 auto&
seekg(std::streamoff pos, std::ios_base::seekdir dir) {
return _filestream.seekg(pos, dir); }
138 [[nodiscard]] std::streampos
tellg() {
return _filestream.tellg(); }
141 [[nodiscard]]
auto eof()
const {
return _filestream.eof(); }
145 [[nodiscard]]
bool good()
const {
return _filestream.good(); }
149 [[nodiscard]]
auto peek() {
return _filestream.peek(); }
164 std::ifstream _filestream;
166 std::streampos _dataStart = 0;
170 size_t _lineCntDataStart = 0;
175#ifndef DOXYGEN_IGNORE
178struct fmt::formatter<NAV::FileReader::FileType> : ostream_formatter
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
The class is responsible for all time-related tasks.
Abstract File Reader class.
Definition FileReader.hpp:31
bool initialize()
Initialize the file reader.
void restore(const json &j)
Restores the node from a json object.
auto peek()
Looking ahead in the stream.
Definition FileReader.hpp:149
bool good() const
Fast error checking.
Definition FileReader.hpp:145
std::string _path
Path to the file.
Definition FileReader.hpp:155
auto & ignore(std::streamsize count, int delim)
Extracts and discards characters from the input stream until and including delim.
Definition FileReader.hpp:126
FileReader & operator=(FileReader &&)=delete
Move assignment operator.
FileType _fileType
File Type.
Definition FileReader.hpp:157
virtual FileType determineFileType()
Virtual Function to determine the File Type.
virtual ~FileReader()=default
Destructor.
GuiResult guiConfig(const char *vFilters, const std::vector< std::string > &extensions, size_t id, const std::string &nameId)
ImGui config.
auto eof() const
Check whether the end of file is reached.
Definition FileReader.hpp:141
FileReader & operator=(const FileReader &)=delete
Copy assignment operator.
auto & read(char *__s, std::streamsize __n)
Extraction without delimiters.
Definition FileReader.hpp:120
std::filesystem::path getFilepath()
Returns the path of the file.
std::vector< std::string > _headerColumns
Header Columns of a CSV file.
Definition FileReader.hpp:160
std::streampos tellg()
Getting the current read position.
Definition FileReader.hpp:138
FileReader(const FileReader &)=delete
Copy constructor.
void resetReader()
Moves the read cursor to the start.
virtual void readHeader()
Virtual Function to read the Header of a file.
auto & getline(std::string &str)
Reads a line from the filestream.
Definition FileReader.hpp:103
auto readsome(char *s, std::streamsize count)
Extracts up to count immediately available characters from the input stream. The extracted characters...
Definition FileReader.hpp:113
json save() const
Saves the node into a json object.
FileReader()=default
Default constructor.
auto & seekg(std::streamoff pos, std::ios_base::seekdir dir)
Changing the current read position.
Definition FileReader.hpp:133
size_t getCurrentLineNumber() const
Get the current line number.
Definition FileReader.hpp:152
FileReader(FileReader &&)=delete
Move constructor.
void deinitialize()
Deinitialize the file reader.
FileType
File Type Enumeration.
Definition FileReader.hpp:35
@ ASCII
Ascii text data.
Definition FileReader.hpp:38
@ BINARY
Binary data.
Definition FileReader.hpp:37
@ NONE
Not specified.
Definition FileReader.hpp:36
GuiResult
Results enum for the gui config.
Definition FileReader.hpp:54
@ PATH_UNCHANGED
No changes made.
Definition FileReader.hpp:55
@ PATH_CHANGED
The path changed and exists.
Definition FileReader.hpp:56
@ PATH_CHANGED_INVALID
The path changed but does not exist or is invalid.
Definition FileReader.hpp:57