2015-04-21 14:55:12 +00:00
|
|
|
class partial_view: public mstch::object {
|
|
|
|
private:
|
|
|
|
int m_value;
|
2015-04-29 08:53:01 +00:00
|
|
|
|
2015-04-21 14:55:12 +00:00
|
|
|
public:
|
2015-10-01 10:16:35 +00:00
|
|
|
partial_view(): m_value(10000) {
|
|
|
|
register_methods(this, std::map<std::string,mstch::node(partial_view::*)()>{
|
2015-04-21 14:55:12 +00:00
|
|
|
{"greeting", &partial_view::greeting},
|
|
|
|
{"farewell", &partial_view::farewell},
|
|
|
|
{"name", &partial_view::name},
|
|
|
|
{"value", &partial_view::value},
|
|
|
|
{"taxed_value", &partial_view::taxed_value},
|
2015-04-23 13:55:18 +00:00
|
|
|
{"in_ca", &partial_view::in_ca}
|
|
|
|
});
|
2015-04-21 14:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node greeting() {
|
|
|
|
return std::string{"Welcome"};
|
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node farewell() {
|
|
|
|
return std::string{"Fair enough, right?"};
|
|
|
|
}
|
|
|
|
|
|
|
|
mstch::node name() {
|
|
|
|
return std::string{"Chris"};
|
|
|
|
}
|
|
|
|
|
|
|
|
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() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const auto partial_view_data = std::make_shared<partial_view>();
|