A abstract base class for all file readers.
More...
#include <datareader.h>
|
| DataReader (const DataReader &rhs)=default |
|
| DataReader (DataReader &&rhs) noexcept=default |
|
DataReader & | operator= (const DataReader &that)=default |
|
DataReader & | operator= (DataReader &&that) noexcept=default |
|
virtual DataReader * | clone () const =0 |
|
const std::vector< FileExtension > & | getExtensions () const |
|
void | addExtension (FileExtension ext) |
|
virtual bool | setOption (std::string_view key, std::any value) |
| Set reader specific options See the documentation of the specific reader for the available options.
|
|
virtual std::any | getOption (std::string_view key) |
| Query the value of an reader specific option.
|
|
template<typename T > |
bool | readsType () const |
|
|
void | checkExists (const std::filesystem::path &path) const |
|
virtual bool | canRead (const std::type_index &index) const =0 |
|
std::ifstream | open (const std::filesystem::path &path, std::ios_base::openmode mode=std::ios_base::in) const |
|
◆ checkExists()
void inviwo::DataReader::checkExists |
( |
const std::filesystem::path & | path | ) |
const |
|
protected |
◆ getOption()
virtual std::any inviwo::DataReader::getOption |
( |
std::string_view | key | ) |
|
|
inlinevirtual |
Query the value of an reader specific option.
- Parameters
-
- Returns
- an std::any with the requested option or an empty std::any if the option was not found
Reimplemented in inviwo::AssimpReader, and inviwo::CSVReader.
◆ open()
std::ifstream inviwo::DataReader::open |
( |
const std::filesystem::path & | path, |
|
|
std::ios_base::openmode | mode = std::ios_base::in ) const |
|
protected |
Open path
in mode
for reading. If the file is not found or the file can't be opened an exception is thrown.
- Exceptions
-
◆ setOption()
virtual bool inviwo::DataReader::setOption |
( |
std::string_view | key, |
|
|
std::any | value ) |
|
inlinevirtual |
Set reader specific options See the documentation of the specific reader for the available options.
- Parameters
-
key | the option to set |
value | the new value for the option |
- Returns
- true if the option was recognized and set, otherwise false
Reimplemented in inviwo::AssimpReader, and inviwo::CSVReader.
The documentation for this class was generated from the following file: