![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <var_reader.hpp>
Public Member Functions | |
VARReader (ValueMap &variable_buffer) | |
VARReader (const VARReader &reader)=delete | |
VARReader (VARReader &&reader) noexcept | |
~VARReader () | |
VARReader & | operator= (const VARReader &reader)=delete |
VARReader & | operator= (VARReader &&reader)=delete |
void | ReadFromFile (std::filesystem::path path, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
void | ReadFromMemory (const std::string &input, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
Private Member Functions | |
virtual void | ReadLine () override |
template<typename T > | |
void | ReadVARVariable () |
template<typename T , std::size_t N, size_t A = alignof(T)> | |
void | ReadVARVariable () |
![]() | |
LineReader & | operator= (const LineReader &reader)=delete |
LineReader & | operator= (LineReader &&reader) noexcept |
void | ReadFromFile (std::filesystem::path path, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
void | ReadFromMemory (const std::string &input, std::regex regex=s_default_regex, SelectionFunction selection_function=s_default_selection_function) |
LineReader () | |
LineReader (const LineReader &reader)=delete | |
LineReader (LineReader &&reader) noexcept | |
~LineReader () | |
const std::filesystem::path & | GetPath () const noexcept |
U32 | GetCurrentLineNumber () const noexcept |
template<typename T > | |
const T | Read () |
template<typename T , std::size_t N, size_t A = alignof(T)> | |
const Array< T, N, A > | Read () |
void | ReadRemainingTokens () |
template<typename T > | |
bool | Contains () const noexcept |
bool | ContainsTokens () const noexcept |
Private Attributes | |
ValueMap & | m_variable_buffer |
Additional Inherited Members | |
![]() | |
using | SelectionFunction = std::function< const std::ssub_match(const std::smatch &) > |
![]() | |
static const std::regex | s_default_regex = std::regex(R"((\"([^\"]*)\")|(\S+))") |
static const SelectionFunction | s_default_selection_function |
A class of VAR file readers for reading variable scripts.
|
explicit |
Constructs a VAR reader.
[in] | variable_buffer | A reference to a map for storing the read variables from file. |
|
delete |
Constructs a VAR reader from the given VAR reader.
[in] | reader | A reference to the VAR reader to copy. |
|
defaultnoexcept |
Constructs a VAR reader by moving the given VAR reader.
[in] | reader | A reference to the VAR reader to move. |
|
default |
Destructs this VAR reader.
Copies the given VAR reader to this VAR reader.
[in] | reader | A reference to a VAR reader to copy. |
Moves the given VAR reader to this VAR reader.
[in] | reader | A reference to a VAR reader to move. |
void mage::LineReader::ReadFromFile |
Reads from the file associated with the given path.
[in] | path | The path. |
[in] | regex | The (line) regex. |
[in] | selection_function | The selection function. |
Exception | Failed to read from the file. |
void mage::LineReader::ReadFromMemory |
Reads from the given input string.
[in] | input | A reference to the input string. |
[in] | regex | The (line) regex. |
[in] | selection_function | The selection function. |
Exception | Failed to read from the given input string. |
|
overrideprivatevirtual |
Reads the current line of this VAR reader.
Exception | Failed to the current line of this VAR reader. |
Implements mage::LineReader.
|
private |
Reads a variable definition.
T | The variable type. |
Exception | Failed to read a variable definition. |
|
private |
Reads an array variable definition.
T | The variable type. |
N | The number of values in the array. |
A | The alignment of the array. |
Exception | Failed to read an array variable definition. |
|
private |
A reference to a map containing the read variables of this VAR reader.