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