From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/lib/misc/escape.hh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tiger-compiler/lib/misc/escape.hh (limited to 'tiger-compiler/lib/misc/escape.hh') 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 +#include + +namespace misc +{ + class escaped + { + public: + std::ostream& print(std::ostream& ostr) const; + + protected: + template escaped(const T&); + + template friend escaped escape(const T&); + + protected: + std::string pobj_str_; + + private: + std::ostream& escape_(std::ostream& o, const std::string& es) const; + }; + + template escaped escape(const T&); + + std::ostream& operator<<(std::ostream& o, const escaped&); + +} // namespace misc + +#include -- cgit v1.2.3