should provide a generic entry point for all "state mark" messages

This commit is contained in:
Fischlurch 2015-12-26 03:03:46 +01:00
parent 3239ea1f87
commit 3c24b4f8e4
2 changed files with 21 additions and 3 deletions

View file

@ -100,7 +100,7 @@ namespace model {
void markMsg (string m) { this->doMsg(m); }
void markErr (string e) { this->doErr(e); }
void markFlash() { this->doFlash();}
void mark(GenNode const& n) { this->doMark(n);}
void mark(GenNode const&);
protected:
virtual void doReset() =0;
@ -115,6 +115,24 @@ namespace model {
private:
};
/** generic handler for all incoming "state mark" messages */
inline void
Tangible::mark (GenNode const& stateMark)
{
if (stateMark.idi.getSym() == "Flash")
this->doFlash();
else
if (stateMark.idi.getSym() == "Error")
this->doErr (stateMark.data.get<string>());
else
if (stateMark.idi.getSym() == "Message")
this->doMsg (stateMark.data.get<string>());
else
this->doMark(stateMark);
}
}} // namespace gui::model

View file

@ -284,8 +284,8 @@ namespace diff{
bool contains (X const& elm) const;
bool matches (GenNode const& o) const { return this->matches(o.idi); } ///< @note \em not comparing payload data. Use equality for that…
bool matches (ID const& id) const { return idi == id; }
bool matches (GenNode const& o) const { return this->matches(o.idi); } ///< @note _not_ comparing payload data. Use equality for that…
bool matches (ID const& id) const { return idi == id; }
bool matches (int number) const { return data.matchNum(number);}
bool matches (int64_t number) const { return data.matchNum(number);}
bool matches (short number) const { return data.matchNum(number);}