#include <json_file_reader.h>
|
| | JSONFileReader (const std::string &filename) |
| | JSONFileReader (const std::filesystem::path &filename) |
| virtual void | open () override final |
| | Attempts to open the file for reading.
|
| template<typename T> |
| T | get_value (const std::string &label) const |
| | Get the value specified by the label.
|
| template<typename T> |
| T | at (const std::string &label) const |
| const json & | get (const std::string &label) const |
| virtual | ~FileReaderBase ()=default |
| bool | eof () const |
| | Returns true if the underlying stream handler has reached the EOF.
|
| Public Member Functions inherited from bitsim::utils::io::FileHandlerBase< std::ifstream > |
| virtual | ~FileHandlerBase () |
| | Destructor. Ensures that the file is properly closed.
|
| FileFormats::Type | get_type () const noexcept |
| | Returns the type/format of the file.
|
| handler_type & | get_file_stream () noexcept |
| | Provides mutable access to the underlying file stream.
|
| std::string | get_filename () const noexcept |
| | Returns the file name associated with this handler.
|
| std::filesystem::path | get_file_path () const noexcept |
| | Returns the file path associated with this handler.
|
| bool | is_open () const noexcept |
| | Checks whether the file is currently open.
|
| virtual void | close () |
| | Closes the file if it is currently open.
|
◆ json
◆ JSONFileReader() [1/2]
| bitsim::utils::io::JSONFileReader::JSONFileReader |
( |
const std::string & | filename | ) |
|
◆ JSONFileReader() [2/2]
| bitsim::utils::io::JSONFileReader::JSONFileReader |
( |
const std::filesystem::path & | filename | ) |
|
Read the JSON file from the given filename
- Parameters
-
| filename | The std::filesystem::path to read the file from |
◆ at()
template<typename T>
| T bitsim::utils::io::JSONFileReader::at |
( |
const std::string & | label | ) |
const |
Returns the object at the specified label. T should be constructed using T(json data) and should be copy constructible
- Parameters
-
- Returns
◆ get()
| const json & bitsim::utils::io::JSONFileReader::get |
( |
const std::string & | label | ) |
const |
|
inline |
- Parameters
-
| label | The label to get the data |
- Returns
- Read reference to the underlying json structure that holds the data for the given label
◆ get_value()
template<typename T>
| T bitsim::utils::io::JSONFileReader::get_value |
( |
const std::string & | label | ) |
const |
Get the value specified by the label.
◆ open()
| void bitsim::utils::io::JSONFileReader::open |
( |
| ) |
|
|
finaloverridevirtual |
The documentation for this class was generated from the following files: