summaryrefslogtreecommitdiff
path: root/libbackend-elements/backend-elements/indentation/buffer.hxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
committerJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
commita15cf65c44d5c224169c32ef5495b68c758134b7 (patch)
tree3419f58fc8e1b315ba8171910ee044c5d467c162 /libbackend-elements/backend-elements/indentation/buffer.hxx
Imported Upstream version 3.3.0.2upstream/3.3.0.2
Diffstat (limited to 'libbackend-elements/backend-elements/indentation/buffer.hxx')
-rw-r--r--libbackend-elements/backend-elements/indentation/buffer.hxx61
1 files changed, 61 insertions, 0 deletions
diff --git a/libbackend-elements/backend-elements/indentation/buffer.hxx b/libbackend-elements/backend-elements/indentation/buffer.hxx
new file mode 100644
index 0000000..7058814
--- /dev/null
+++ b/libbackend-elements/backend-elements/indentation/buffer.hxx
@@ -0,0 +1,61 @@
+// file : backend-elements/indentation/buffer.hxx
+// author : Boris Kolpackov <boris@kolpackov.net>
+// copyright : Copyright (c) 2005-2010 Boris Kolpackov
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef BACKEND_ELEMENTS_INDENTATION_BUFFER_HXX
+#define BACKEND_ELEMENTS_INDENTATION_BUFFER_HXX
+
+#include <backend-elements/types.hxx>
+
+#include <string>
+
+namespace BackendElements
+{
+ namespace Indentation
+ {
+ template <typename C>
+ class Buffer: public NonCopyable
+ {
+ public:
+ struct Write {};
+
+ public:
+ virtual
+ ~Buffer ()
+ {
+ }
+
+ public:
+ typedef
+ std::char_traits<C>
+ Traits;
+
+ typedef
+ typename Traits::char_type
+ AsChar;
+
+ typedef
+ typename Traits::int_type
+ AsInt;
+
+ public:
+ virtual AsInt
+ put (AsChar 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;
+ };
+ }
+}
+
+#include <backend-elements/indentation/buffer.txx>
+
+#endif // BACKEND_ELEMENTS_INDENTATION_BUFFER_HXX