File: higher_order_sections.hpp

package info (click to toggle)
mstch 1.0.2-4
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 940 kB
  • sloc: cpp: 1,429; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class higher_order_sections: public mstch::object {
 private:
  std::string m_helper;
 public:
  higher_order_sections(): m_helper("To tinker?") {
    register_methods(this, std::map<std::string,mstch::node(higher_order_sections::*)()>{
        {"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() {
    return mstch::lambda{[this](const std::string& text) -> mstch::node {
      return "<b>" + text + "</b> " + m_helper;
    }};
  }
};

const mstch::node higher_order_sections_data = std::make_shared<higher_order_sections>();