summaryrefslogtreecommitdiff
path: root/CIAO/CCF/CCF/CodeGenerationKit/IndentationBuffer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/CCF/CCF/CodeGenerationKit/IndentationBuffer.hpp')
-rw-r--r--CIAO/CCF/CCF/CodeGenerationKit/IndentationBuffer.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/CIAO/CCF/CCF/CodeGenerationKit/IndentationBuffer.hpp b/CIAO/CCF/CCF/CodeGenerationKit/IndentationBuffer.hpp
new file mode 100644
index 00000000000..713f917e834
--- /dev/null
+++ b/CIAO/CCF/CCF/CodeGenerationKit/IndentationBuffer.hpp
@@ -0,0 +1,61 @@
+// file : CCF/CodeGenerationKit/IndentationBuffer.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_CODE_GENERATION_KIT_INDENTATION_BUFFER_HPP
+#define CCF_CODE_GENERATION_KIT_INDENTATION_BUFFER_HPP
+
+#include "CCF/CompilerElements/ExH.hpp"
+
+#include <string>
+
+namespace Indentation
+{
+ template <typename C>
+ class Buffer
+ {
+ public:
+ class Exception_ {};
+ typedef
+ ExH::Compound <Exception_, ExH::Logic::DescriptiveException>
+ Exception;
+
+ class EndOfStream_ {};
+ typedef
+ ExH::Compound <EndOfStream_, Exception>
+ EndOfStream;
+
+ public:
+ virtual
+ ~Buffer () throw () {}
+
+ public:
+ typedef
+ std::char_traits<C>
+ traits_type;
+
+ typedef
+ typename traits_type::char_type
+ char_type;
+
+ typedef
+ typename traits_type::int_type
+ int_type;
+
+ public:
+ virtual int_type
+ put (char_type c) throw (Exception, ExH::System::Exception) = 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 () throw (EndOfStream, Exception, ExH::System::Exception) = 0;
+ };
+}
+
+#endif // CCF_CODE_GENERATION_KIT_INDENTATION_BUFFER_HPP