mstch/test/data/higher_order_sections.hpp

28 lines
765 B
C++
Raw Normal View History

2015-04-23 15:55:18 +02:00
class higher_order_sections: public mstch::object {
private:
std::string m_helper;
public:
2015-10-01 12:16:35 +02:00
higher_order_sections(): m_helper("To tinker?") {
register_methods(this, std::map<std::string,mstch::node(higher_order_sections::*)()>{
2015-04-23 15:55:18 +02:00
{"name", &higher_order_sections::name},
{"helper", &higher_order_sections::helper},
{"bolder", &higher_order_sections::bolder}
});
}
mstch::node name() {
return std::string{"Tater"};
}
mstch::node helper() {
return m_helper;
}
mstch::node bolder() {
2015-05-05 14:15:47 +02:00
return mstch::lambda{[this](const std::string& text) -> mstch::node {
2015-05-04 16:14:32 +02:00
return "<b>" + text + "</b> " + m_helper;
2015-04-23 15:55:18 +02:00
}};
}
};
const mstch::node higher_order_sections_data = std::make_shared<higher_order_sections>();