From 8286ac511144e4f17d34eac9affb97e50646344a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:25:44 +0200 Subject: Imported Upstream version 4.0.0 --- libcutl/cutl/compiler/code-stream.txx | 95 +++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 libcutl/cutl/compiler/code-stream.txx (limited to 'libcutl/cutl/compiler/code-stream.txx') diff --git a/libcutl/cutl/compiler/code-stream.txx b/libcutl/cutl/compiler/code-stream.txx new file mode 100644 index 0000000..232c5cc --- /dev/null +++ b/libcutl/cutl/compiler/code-stream.txx @@ -0,0 +1,95 @@ +// file : cutl/compiler/code-stream.txx +// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +namespace cutl +{ + namespace compiler + { + // code_stream + // + + template + code_stream::~code_stream () + { + } + + // from_streambuf_adapter + // + + template + void from_streambuf_adapter:: + put (C c) + { + int_type i (stream_.sputc (c)); + + if (i == traits_type::eof ()) + throw eof (); + } + + template + void from_streambuf_adapter:: + unbuffer () + { + if (stream_.pubsync () != 0) + throw sync (); + } + + // to_streambuf_adapter + // + + template + typename to_streambuf_adapter::int_type to_streambuf_adapter:: + overflow (int_type i) + { + try + { + stream_.put (traits_type::to_char_type (i)); + return i; + } + catch (typename from_streambuf_adapter::eof const&) + { + return traits_type::eof (); + } + } + + template + int to_streambuf_adapter:: + sync () + { + return 0; + } + + // ostream_filter + // + + template