Castor3D 0.16.0
Multiplatform 3D engine
|
#include <FileParser.hpp>
Public Member Functions | |
CU_API | FileParser (SectionId rootSectionId, void *rootBlockContext=nullptr) |
Constructor. | |
CU_API | FileParser (LoggerInstance &logger, SectionId rootSectionId, void *rootBlockContext=nullptr) |
Constructor. | |
virtual CU_API | ~FileParser () noexcept=default |
Destructor. | |
CU_API void | registerParsers (String const &name, AdditionalParsers const &parsers) |
Registers additional parsers. | |
CU_API void | processFile (String const &appName, Path path, PreprocessedFile &preprocessed) |
Parsing function. | |
CU_API void | processFile (Path const &path, PreprocessedFile &preprocessed) |
Parsing function. | |
CU_API void | processFile (Path const &path, String const &content, PreprocessedFile &preprocessed) |
Parsing function. | |
CU_API PreprocessedFile | processFile (String const &appName, Path const &path) |
Parsing function. | |
CU_API PreprocessedFile | processFile (Path const &path) |
Parsing function. | |
CU_API PreprocessedFile | processFile (Path const &path, String const &content) |
Parsing function. | |
CU_API bool | parseFile (String const &appName, Path const &path) |
Parsing function. | |
CU_API bool | parseFile (Path const &path) |
Parsing function. | |
CU_API bool | parseFile (Path const &path, String const &content) |
Parsing function. | |
CU_API void | parseError (String const &functionName, uint64_t lineIndex, String const &error) |
Logs an error in the log file. | |
CU_API void | parseWarning (String const &functionName, uint64_t lineIndex, String const &warning) |
Logs a warning in the log file. | |
CU_API void | addParser (SectionId oldSection, SectionId newSection, String const &name, ParserFunction const &function, ParserParameterArray const ¶ms=ParserParameterArray()) |
adds a parser function to the parsers list. | |
CU_API void | addParser (SectionId section, String const &name, ParserFunction const &function, ParserParameterArray const ¶ms=ParserParameterArray()) |
adds a parser function to the parsers list. | |
bool | isIgnored () const |
Tells if the read lines are to be ignored. | |
void | ignore () |
Increments ignore level. | |
LoggerInstance & | getLogger () const |
SectionId | getRootSectionId () const |
void * | getRootBlockContext () const |
void | validate (PreprocessedFile &preprocessed) |
String | getSectionName (SectionId section) const |
void | cleanupParser (PreprocessedFile &preprocessed) |
auto const & | getAdditionalParsers () const |
Protected Member Functions | |
virtual CU_API FileParserContextUPtr | doInitialiseParser (Path const &path) |
Specific initialisation function. | |
virtual CU_API void | doCleanupParser (PreprocessedFile &preprocessed)=0 |
Specific cleanup. | |
virtual CU_API bool | doDiscardParser (PreprocessedFile &preprocessed, StringView line) |
Function called when no parser is found for the line. | |
virtual CU_API void | doValidate (PreprocessedFile &preprocessed)=0 |
Function called when file parsing is completed with no error. | |
virtual CU_API String | doGetSectionName (SectionId section) const =0 |
Gives the name associated to section ID. | |
virtual CU_API castor::RawUniquePtr< FileParser > | doCreateParser () const =0 |
Protected Member Functions inherited from castor::NonMovable | |
NonMovable ()=default | |
Constructor. | |
~NonMovable () noexcept=default | |
Destructor. | |
Protected Attributes | |
LoggerInstance & | m_logger |
AttributeParsers | m_parsers |
bool | m_ignored { false } |
StrStrMap | m_defines |
|
explicit |
Constructor.
[in] | rootSectionId | The root section id. |
[in] | rootBlockContext | The root block context. |
CU_API castor::FileParser::FileParser | ( | LoggerInstance & | logger, |
SectionId | rootSectionId, | ||
void * | rootBlockContext = nullptr ) |
Constructor.
[in] | logger | The logger instance. |
[in] | rootSectionId | The root section id. |
[in] | rootBlockContext | The root block context. |
|
virtualdefaultnoexcept |
Destructor.
CU_API void castor::FileParser::addParser | ( | SectionId | oldSection, |
SectionId | newSection, | ||
String const & | name, | ||
ParserFunction const & | function, | ||
ParserParameterArray const & | params = ParserParameterArray() ) |
adds a parser function to the parsers list.
[in] | oldSection | The parser section onto which the function is applied. |
[in] | newSection | The parser section resulting of the function application. |
[in] | name | The parser name. |
[in] | function | The parser function. |
[in] | params | The expected parameters. |
CU_API void castor::FileParser::addParser | ( | SectionId | section, |
String const & | name, | ||
ParserFunction const & | function, | ||
ParserParameterArray const & | params = ParserParameterArray() ) |
adds a parser function to the parsers list.
[in] | section | The parser section. |
[in] | name | The parser name. |
[in] | function | The parser function. |
[in] | params | The expected parameters. |
|
inline |
|
protectedpure virtual |
|
protectedpure virtual |
|
protectedvirtual |
Function called when no parser is found for the line.
[in] | preprocessed | The preprocessed file. |
[in] | line | The line. |
|
protectedpure virtual |
Gives the name associated to section ID.
[in] | section | The section ID. |
Referenced by getSectionName().
|
protectedvirtual |
Specific initialisation function.
[in] | path | The file access path. |
|
protectedpure virtual |
Function called when file parsing is completed with no error.
Referenced by validate().
|
inline |
|
inline |
References m_logger.
|
inline |
|
inline |
|
inline |
Increments ignore level.
References m_ignored.
|
inline |
Tells if the read lines are to be ignored.
References m_ignored.
CU_API void castor::FileParser::parseError | ( | String const & | functionName, |
uint64_t | lineIndex, | ||
String const & | error ) |
Logs an error in the log file.
[in] | functionName | The error function. |
[in] | lineIndex | The error line. |
[in] | error | The error text. |
Parsing function.
[in] | path | The file access path. |
true
if OK. Parsing function.
[in] | path | The file access path. |
[in] | content | The file content. |
true
if OK. Parsing function.
[in] | appName | The application name, if a dezip is needed. |
[in] | path | The file access path. |
true
if OK. CU_API void castor::FileParser::parseWarning | ( | String const & | functionName, |
uint64_t | lineIndex, | ||
String const & | warning ) |
Logs a warning in the log file.
[in] | functionName | The warning function. |
[in] | lineIndex | The warning line. |
[in] | warning | The warning text. |
CU_API PreprocessedFile castor::FileParser::processFile | ( | Path const & | path | ) |
Parsing function.
[in] | path | The file access path. |
CU_API void castor::FileParser::processFile | ( | Path const & | path, |
PreprocessedFile & | preprocessed ) |
Parsing function.
[in] | path | The file access path. |
[in] | preprocessed | The preprocessed file. |
CU_API PreprocessedFile castor::FileParser::processFile | ( | Path const & | path, |
String const & | content ) |
Parsing function.
[in] | path | The file access path. |
[in] | content | The file content. |
CU_API void castor::FileParser::processFile | ( | Path const & | path, |
String const & | content, | ||
PreprocessedFile & | preprocessed ) |
Parsing function.
[in] | path | The file access path. |
[in] | content | The file content. |
[in] | preprocessed | The preprocessed file. |
CU_API PreprocessedFile castor::FileParser::processFile | ( | String const & | appName, |
Path const & | path ) |
Parsing function.
[in] | appName | The application name, if a dezip is needed. |
[in] | path | The file access path. |
CU_API void castor::FileParser::processFile | ( | String const & | appName, |
Path | path, | ||
PreprocessedFile & | preprocessed ) |
Parsing function.
[in] | appName | The application name, if a dezip is needed. |
[in] | path | The file access path. |
[in] | preprocessed | The preprocessed file. |
CU_API void castor::FileParser::registerParsers | ( | String const & | name, |
AdditionalParsers const & | parsers ) |
Registers additional parsers.
[in] | name | The registering name. |
[in] | parsers | The parsers. |
|
inline |
|
protected |
The defines map.
|
protected |
Tells the lines parsed are to be ignored.
Referenced by ignore(), and isIgnored().
|
protected |
Referenced by getLogger().
|
protected |
The parser functions.