diff options
Diffstat (limited to 'tiger-compiler/lib/misc/escape.hh')
| -rw-r--r-- | tiger-compiler/lib/misc/escape.hh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tiger-compiler/lib/misc/escape.hh b/tiger-compiler/lib/misc/escape.hh new file mode 100644 index 0000000..199c8b2 --- /dev/null +++ b/tiger-compiler/lib/misc/escape.hh @@ -0,0 +1,36 @@ +/** + ** \file misc/escape.hh + ** \brief Escape: escaping special characters for output. + **/ + +#pragma once + +#include <iosfwd> +#include <string> + +namespace misc +{ + class escaped + { + public: + std::ostream& print(std::ostream& ostr) const; + + protected: + template <class T> escaped(const T&); + + template <class T> friend escaped escape(const T&); + + protected: + std::string pobj_str_; + + private: + std::ostream& escape_(std::ostream& o, const std::string& es) const; + }; + + template <class T> escaped escape(const T&); + + std::ostream& operator<<(std::ostream& o, const escaped&); + +} // namespace misc + +#include <misc/escape.hxx> |
