2015-04-21 22:55:12 +08:00
|
|
|
class simple: public mstch::object {
|
|
|
|
private:
|
|
|
|
int m_value;
|
|
|
|
public:
|
|
|
|
simple():
|
2015-04-23 21:55:18 +08:00
|
|
|
m_value{10000}
|
2015-04-21 22:55:12 +08:00
|
|
|
{
|
|
|
|
register_methods(this, {
|
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() {
|
|
|
|
return static_cast<int>(m_value - (m_value * 0.4));
|
|
|
|
}
|
|
|
|
|
|
|
|
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>();
|