blob: 713f917e834adc69d64c1541589e72dcfd83c0e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
|