2015-04-21 14:55:12 +00:00
|
|
|
class simple: public mstch::object {
|
|
|
|
private:
|
|
|
|
int m_value;
|
|
|
|
public:
|
|
|
|
simple():
|
2015-10-01 10:16:35 +00:00
|
|
|
m_value(10000)
|
2015-04-21 14:55:12 +00:00
|
|
|
{
|
2015-10-01 10:16:35 +00:00
|
|
|
register_methods(this, std::map<std::string,mstch::node(simple::*)()>{
|
2015-04-23 13:55:18 +00:00
|
|
|
{"name", &simple::name},
|
|
|
|
{"value", &simple::value},
|
|
|
|
{"taxed_value", &simple::taxed_value},
|
|
|
|
{"in_ca", &simple::in_ca}});
|
2015-04-21 14:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node name() {
|
2015-04-23 13:55:18 +00:00
|
|
|
return std::string{"Chris"};
|
2015-04-21 14:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node value() {
|
|
|
|
return m_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node taxed_value() {
|
2015-04-29 08:53:01 +00:00
|
|
|
return m_value - (m_value * 0.4);
|
2015-04-21 14:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node in_ca() {
|
2015-04-23 13:55:18 +00:00
|
|
|
return true;
|
2015-04-21 14:55:12 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-04-23 13:55:18 +00:00
|
|
|
const auto simple_data = std::make_shared<simple>();
|