summaryrefslogtreecommitdiff
path: root/libcutl/cutl/compiler/code-stream.hxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-06 10:24:11 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-06 10:24:11 +0100
commit4538829ab86b5a1cd4e845e7eab165029c9d6d46 (patch)
treebbadf39aed0610c8f8f7b41fefff47773b8ac205 /libcutl/cutl/compiler/code-stream.hxx
parent23d41842168ac1a1580111b9c5c73500ceee3d57 (diff)
parentaad5ad9bf0c02aa4e79bc6b7d6c934612fff4026 (diff)
Update upstream source from tag 'upstream/4.2.0'
Update to upstream version '4.2.0' with Debian dir 1b38df7bbcf313223de3c50107ac0255090fe647
Diffstat (limited to 'libcutl/cutl/compiler/code-stream.hxx')
-rw-r--r--libcutl/cutl/compiler/code-stream.hxx154
1 files changed, 0 insertions, 154 deletions
diff --git a/libcutl/cutl/compiler/code-stream.hxx b/libcutl/cutl/compiler/code-stream.hxx
deleted file mode 100644
index bfd33d0..0000000
--- a/libcutl/cutl/compiler/code-stream.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-// file : cutl/compiler/code-stream.hxx
-// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CUTL_COMPILER_CODE_STREAM_HXX
-#define CUTL_COMPILER_CODE_STREAM_HXX
-
-#include <memory> // std::auto_ptr
-#include <ostream>
-
-#include <cutl/exception.hxx>
-
-namespace cutl
-{
- namespace compiler
- {
- //
- //
- template <typename C>
- class code_stream
- {
- public:
- code_stream () {}
-
- virtual
- ~code_stream ();
-
- public:
- virtual void
- put (C) = 0;
-
- // Unbuffer flushes internal formatting buffers (if any).
- // Note that unbuffer is not exactly flushing since it can
- // result in formatting errors and in general can not be
- // called at arbitrary points. Natural use case would be
- // to call unbuffer at the end of the stream when no more
- // data is expected.
- //
- virtual void
- unbuffer () = 0;
-
- private:
- code_stream (code_stream const&);
-
- code_stream&
- operator= (code_stream const&);
- };
-
- //
- //
- template <typename C>
- class from_streambuf_adapter: public code_stream<C>
- {
- public:
- typedef typename std::basic_streambuf<C>::traits_type traits_type;
- typedef typename std::basic_streambuf<C>::int_type int_type;
-
- class eof: exception {};
- class sync: exception {};
-
- public:
- from_streambuf_adapter (std::basic_streambuf<C>& stream)
- : stream_ (stream)
- {
- }
-
- private:
- from_streambuf_adapter (from_streambuf_adapter const&);
-
- from_streambuf_adapter&
- operator= (from_streambuf_adapter const&);
-
- public:
- virtual void
- put (C c);
-
- virtual void
- unbuffer ();
-
- private:
- std::basic_streambuf<C>& stream_;
- };
-
- //
- //
- template <typename C>
- class to_streambuf_adapter: public std::basic_streambuf<C>
- {
- public:
- typedef typename std::basic_streambuf<C>::traits_type traits_type;
- typedef typename std::basic_streambuf<C>::int_type int_type;
-
- public:
- to_streambuf_adapter (code_stream<C>& stream)
- : stream_ (stream)
- {
- }
-
- private:
- to_streambuf_adapter (to_streambuf_adapter const&);
-
- to_streambuf_adapter&
- operator= (to_streambuf_adapter const&);
-
- public:
- virtual int_type
- overflow (int_type i);
-
- // Does nothing since calling unbuffer here would be dangerous.
- // See the note in code_stream.
- //
- virtual int
- sync ();
-
- private:
- code_stream<C>& stream_;
- };
-
- //
- //
- template <template <typename> class S, typename C>
- class ostream_filter
- {
- public:
- typedef S<C> stream_type;
-
- ostream_filter (std::basic_ostream<C>& os);
- ~ostream_filter ();
-
- stream_type&
- stream ()
- {
- return stream_;
- }
-
- private:
- ostream_filter (ostream_filter const&);
-
- ostream_filter&
- operator= (ostream_filter const&);
-
- private:
- std::basic_ostream<C>& os_;
- std::basic_streambuf<C>* prev_;
- from_streambuf_adapter<C> from_adapter_;
- stream_type stream_;
- to_streambuf_adapter<C> to_adapter_;
- };
- }
-}
-
-#include <cutl/compiler/code-stream.txx>
-
-#endif // CUTL_COMPILER_CODE_STREAM_HXX