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