mstch/test/data/simple.hpp

32 lines
586 B
C++
Raw Normal View History

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