|
stmm-games-doc
0.32.0
|

Public Member Functions | |
| virtual | ~XmlEventParser ()=default |
| XmlEventParser (const std::string &sEventName) | |
| Constructor. More... | |
| const std::string & | getEventName () const |
| The event name. More... | |
| virtual Event * | parseEvent (GameCtx &oCtx, const xmlpp::Element *p0Element)=0 |
| Parse and create an event instance. More... | |
| virtual void | recycleEvents (std::unique_ptr< Event > &refEvent) |
| Recycle the event if it is of a type created by this instance. More... | |
| virtual int32_t | parseEventMsgName (ConditionalCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttr, const std::string &sMsgName) |
| Returns event type's msg value from msg name. More... | |
| virtual int32_t | parseEventListenerGroupName (GameCtx &oCtx, const xmlpp::Element *p0Element, const std::string &sAttr, const std::string &sListenerGroupName) |
| Returns event type listener group value from name. More... | |
Protected Member Functions | |
| bool | getBlock (GameCtx &oCtx, const std::string &sName, Block &oBlock) |
| Return named block. More... | |
| Event * | parseChildEvent (GameCtx &oCtx, const xmlpp::Element *p0Element) |
| Parses an event and adds it to the level. More... | |
| void | parseEventBase (GameCtx &oCtx, const xmlpp::Element *p0Element, Event::Init &oInit) |
| Parse event base. More... | |
| Event * | integrateAndAdd (GameCtx &oCtx, unique_ptr< Event > refEvent, const xmlpp::Element *p0Element) |
| Integrate the event add to level. More... | |
| int32_t | parseEventAttrRepeat (GameCtx &oCtx, const xmlpp::Element *p0EventElement) |
| Helper function for the 'repeat' attribute. More... | |
| int32_t | parseEventAttrStep (GameCtx &oCtx, const xmlpp::Element *p0EventElement) |
| Helper function for the 'step' attribute. More... | |
| int32_t | parseEventAttrRandomProb (GameCtx &oCtx, const xmlpp::Element *p0EventElement) |
| Helper function for the 'prob' attribute. More... | |
| bool | isReservedChildElementOfEvent (const std::string &sElementName) const |
| Tells whether a child element name of Event is reserved. More... | |
| XmlConditionalParser & | getXmlConditionalParser () |
| Get the conditional parser. More... | |
| XmlTraitsParser & | getXmlTraitsParser () |
| Get the traits parser. More... | |
|
virtualdefault |
| stmg::XmlEventParser::XmlEventParser | ( | const std::string & | sEventName | ) |
Constructor.
| sEventName | The event name. Cannot be empty. |
|
protected |
Return named block.
| oCtx | The context. |
| sName | The block name. Cannot be empty. |
| oBlock | The block structure to be filled. |
| const std::string& stmg::XmlEventParser::getEventName | ( | ) | const |
The event name.
|
protected |
Get the conditional parser.
Cannot be called from the subclass constructor.
|
protected |
Get the traits parser.
Cannot be called from the subclass constructor.
|
protected |
Integrate the event add to level.
Performs the xml specific integration that links the event to others and to widgets and adds the instance to the level, which will own it.
| oCtx | The context. |
| refEvent | The event. Cannot be null. |
| p0Element | The event element. Cannot be null. |
|
protected |
Tells whether a child element name of Event is reserved.
Use this when using getXmlConditionalParser().visitElementChildren().
Example: ListenerGroup or Filter.
| sElementName | The element name in question. Cannot be empty. |
|
protected |
Parses an event and adds it to the level.
This method can be used by events that directly handle other events.
| oCtx | The context. |
| p0Element | The event element. Cannot be null. |
|
pure virtual |
Parse and create an event instance.
The implementation must call integrateAndAdd() to add the newly created event to the level which will own it.
| oCtx | The game context. |
| p0Element | The element. Cannot be null. |
| std::runtime_error. |
Implemented in stmg::XmlOthersReceiverEventParser, stmg::XmlArrayEventParser, stmg::XmlStaticGridEventParser, stmg::XmlBackgroundEventParser, stmg::XmlPositionerEventParser, stmg::XmlTileAnimatorEventParser, stmg::XmlAlarmsEventParser, stmg::XmlCumulCmpEventParser, stmg::XmlDelayedQueueEventParser, stmg::XmlSpeedEventParser, stmg::XmlRandomEventParser, stmg::XmlShowTextEventParser, stmg::XmlSoundEventParser, stmg::XmlVariableEventParser, stmg::XmlScrollerEventParser, stmg::XmlSysEventParser, stmg::XmlFillerEventParser, stmg::XmlSelectEventParser, stmg::XmlLogEventParser, stmg::XmlOthersSenderEventParser, and stmg::XmlSquarsorEventParser.
|
protected |
Helper function for the 'prob' attribute.
Expects the value to be > 0. Default is 1.
| oCtx | The context. |
| p0EventElement | The event element. Cannot be null. |
| std::runtime_exception. |
|
protected |
Helper function for the 'repeat' attribute.
Expects the value to be > 0 or -1 (infinite). Default is -1.
| oCtx | The context. |
| p0EventElement | The event element. Cannot be null. |
| std::runtime_exception. |
|
protected |
Helper function for the 'step' attribute.
Expects the value to be > 0. Default is 1.
| oCtx | The context. |
| p0EventElement | The event element. Cannot be null. |
| std::runtime_exception. |
|
protected |
Parse event base.
This function should be called rather than filling the attributes by hand in the subclass parser.
| oCtx | The context. |
| p0Element | The event element. Cannot be null. |
| oInit | The even initialization data to fill. |
|
virtual |
Returns event type listener group value from name.
Usually listener group the name is the same as defined in the event class as an enum without the 'LISTENER_GROUP_' prefix.
Since also the Event base class has at least the LISTENER_GROUP_FINISHED enum and therefore the name 'FINISHED' defined, subclasses of this function should call XmlEventParser::parseEventListenerGroupName() after checking their own enums.
| oCtx | The game context. |
| p0Element | The element containing the the attribute. Cannot be null. |
| sAttr | The attribute name containing the listener group name. Cannot be empty. |
| sListenerGroupName | The listener group name. Cannot be empty. |
| If | the listener group name is unknown. |
Reimplemented in stmg::XmlArrayEventParser, stmg::XmlStaticGridEventParser, stmg::XmlBackgroundEventParser, stmg::XmlAlarmsEventParser, stmg::XmlCumulCmpEventParser, stmg::XmlDelayedQueueEventParser, stmg::XmlRandomEventParser, stmg::XmlSoundEventParser, stmg::XmlTileAnimatorEventParser, stmg::XmlVariableEventParser, stmg::XmlSpeedEventParser, stmg::XmlScrollerEventParser, stmg::XmlSysEventParser, stmg::XmlFillerEventParser, and stmg::XmlSquarsorEventParser.
|
virtual |
Returns event type's msg value from msg name.
Usually the msg name is the same as defined in the event class as an enum without the 'MESSAGE_' prefix.
Subclasses of this function should call XmlEventParser::parseEventMsgName() after checking their own enums. The function will throw an error.
| oCtx | The game context. |
| p0Element | The element containing the the attribute. Cannot be null. |
| sAttr | The attribute name containing the message name. Cannot be empty. |
| sMsgName | The message name. Cannot be empty. |
| If | the msg name is unknown. |
Reimplemented in stmg::XmlArrayEventParser, stmg::XmlStaticGridEventParser, stmg::XmlBackgroundEventParser, stmg::XmlPositionerEventParser, stmg::XmlAlarmsEventParser, stmg::XmlCumulCmpEventParser, stmg::XmlDelayedQueueEventParser, stmg::XmlRandomEventParser, stmg::XmlShowTextEventParser, stmg::XmlSoundEventParser, stmg::XmlVariableEventParser, stmg::XmlScrollerEventParser, stmg::XmlFillerEventParser, and stmg::XmlSquarsorEventParser.
|
virtual |
Recycle the event if it is of a type created by this instance.
The default implementation is empty.
| refEvent | The event. Cannot be null. If recycled is null after function call. |
1.8.13