10 #include <hilti/base/util.h> 29 bool output(std::ostream& out) {
return util::copyStream(_out, out); }
32 auto str()
const {
return _out.str(); }
47 void quoted(
const std::string& s);
50 void comment(
const std::string& s);
70 std::stringstream _out;
76 bool _in_comment =
false;
79 namespace code_formatter {
83 #define __DEFINE_MANIPULATOR0(x) \ 84 template<typename Formatter> \ 85 class x : isManipulator { \ 87 Formatter& operator()(Formatter& f) const { \ 93 #define __DEFINE_MANIPULATOR1(x, t) \ 94 template<typename Formatter> \ 95 class x : isManipulator { \ 99 x(t _t) : _t(std::move(_t)) {} \ 100 Formatter& operator()(Formatter& f) const { \ 106 namespace code_formatter {
107 __DEFINE_MANIPULATOR0(
dedent)
108 __DEFINE_MANIPULATOR0(
eol)
109 __DEFINE_MANIPULATOR0(eos)
110 __DEFINE_MANIPULATOR0(
indent)
112 __DEFINE_MANIPULATOR1(
quoted, std::string)
113 __DEFINE_MANIPULATOR1(
comment, std::string)
Definition: optional.h:79