#include <SdlCommandParser.h>
|
virtual bool | beginCommand (ESdlCommandType commandType, const SdlClass *targetClass, SdlInputContext *out_ctx)=0 |
| Called when the parser starts processing a command.
|
|
virtual void | endCommand ()=0 |
| Called when the parser finishes processing a command.
|
|
virtual ISdlResource * | createResource (std::string_view resourceName, const SdlInputContext &ctx, ESdlCommandType commandType)=0 |
|
virtual void | initResource (std::string_view resourceName, ISdlResource *resource, const SdlInputContext &ctx, SdlInputClauses &clauses, ESdlCommandType commandType)=0 |
|
virtual ISdlResource * | getResource (std::string_view resourceName, const SdlInputContext &ctx)=0 |
|
virtual void | runExecutor (std::string_view executorName, const SdlInputContext &ctx, ISdlResource *targetResource, SdlInputClauses &clauses, ESdlCommandType commandType)=0 |
| Called when an executor command has been processed and is ready to run.
|
|
virtual void | commandVersionSet (const SemanticVersion &version, const SdlInputContext &ctx)=0 |
|
virtual void | storeNamedDataPacket (std::string_view packetName, const SdlInputClauses &packet, const SdlInputContext &ctx)=0 |
|
◆ SdlCommandParser() [1/2]
ph::SdlCommandParser::SdlCommandParser |
( |
TSpanView< const SdlClass * > | targetClasses | ) |
|
|
explicit |
◆ SdlCommandParser() [2/2]
ph::SdlCommandParser::SdlCommandParser |
( |
TSpanView< const SdlClass * > | targetClasses, |
|
|
const Path & | sceneWorkingDirectory ) |
◆ ~SdlCommandParser()
ph::SdlCommandParser::~SdlCommandParser |
( |
| ) |
|
|
virtualdefault |
◆ beginCommand()
Called when the parser starts processing a command.
- Returns
- Whether to generate command for this class.
Implemented in ph::SdlSceneFileReader.
◆ commandVersionSet()
◆ createResource()
◆ endCommand()
virtual void ph::SdlCommandParser::endCommand |
( |
| ) |
|
|
protectedpure virtual |
◆ flush()
void ph::SdlCommandParser::flush |
( |
| ) |
|
Force the parse of commands that were cached in the parser.
◆ getCommandVersion()
◆ getPacketInterface()
◆ getResource()
◆ getSceneWorkingDirectory()
const Path & ph::SdlCommandParser::getSceneWorkingDirectory |
( |
| ) |
const |
|
inline |
◆ initResource()
◆ numParsedCommands()
std::size_t ph::SdlCommandParser::numParsedCommands |
( |
| ) |
const |
|
inline |
◆ numParseErrors()
std::size_t ph::SdlCommandParser::numParseErrors |
( |
| ) |
const |
|
inline |
◆ parse()
void ph::SdlCommandParser::parse |
( |
std::string_view | rawCommandSegment | ) |
|
Enters a string and parse it as one or more commands.
The command segment must have valid syntax. The method will potentially cache the command segment in subsequent calls until a command is complete, at which point the command will be parsed and the result will act on the target (e.g., a scene, depending on the implementation).
A valid command segment is a portion of a complete command or a chunk of multiple commands that do not break any keyword or symbol of PSDL. For example, you can break any opening/closing braces, but you cannot break a type name.
- Parameters
-
commandSegment | A valid segment of command. |
◆ runExecutor()
Called when an executor command has been processed and is ready to run.
A side note for SDL grammer: An executor may be called with an explicit class type, or with the type part omitted and let the class type deduced from the reference. Calling with explicit class type has potential performance benefit as the parser may not need to search the full class hierarchy to find the target executor to call (deducing from the reference itself always yield the exact, most derived type); however, calling with explicit class type may miss the derived implementation if the executor is overridden (the parser will only search from the class type you specified).
For implementations, obtaining the target class from context object should be preferred over obtaining from the resource itself, since an executor may be called with an explicit class and context object has this information.
Implemented in ph::SdlSceneFileReader.
◆ setPacketInterface()
◆ setSceneWorkingDirectory()
void ph::SdlCommandParser::setSceneWorkingDirectory |
( |
const Path & | directory | ) |
|
◆ storeNamedDataPacket()
The documentation for this class was generated from the following files: