Define the Notify() method on UtilityParser
This commit is contained in:
parent
d20e4154fe
commit
557d9a047f
1 changed files with 10 additions and 4 deletions
|
@ -70,14 +70,14 @@ private:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UtilityParsers handle small reusable bits of YAML and their constructors take
|
* UtilityParsers handle small reusable bits of YAML. Their constructors take a
|
||||||
* a C++11 lambda, which will be called back with the result of the parsed data.
|
* C++11 lambda, which will be called back with the result of the parsed data.
|
||||||
*/
|
*/
|
||||||
template<typename CallbackType>
|
template<typename T>
|
||||||
struct UtilityParser
|
struct UtilityParser
|
||||||
: public Parser
|
: public Parser
|
||||||
{
|
{
|
||||||
typedef std::function<CallbackType> CallbackFunction;
|
typedef std::function<void (T)> CallbackFunction;
|
||||||
|
|
||||||
UtilityParser(Scene& scene,
|
UtilityParser(Scene& scene,
|
||||||
ParserStack& parsers,
|
ParserStack& parsers,
|
||||||
|
@ -90,6 +90,12 @@ struct UtilityParser
|
||||||
~UtilityParser()
|
~UtilityParser()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void
|
||||||
|
Notify(T value)
|
||||||
|
{
|
||||||
|
mCallback(value);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CallbackFunction mCallback;
|
CallbackFunction mCallback;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue