diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/lib/misc/escape.hh | |
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> |
