libart-paperback 0.1.0-a.1.20260122225059.e5fea306241a
PDF (1.4) library for C++
writer.hxx
1#ifndef art__paperback__carousel__writer_hxx_
2#define art__paperback__carousel__writer_hxx_
3
4#include <art/paperback/types.hxx>
5#include <art/paperback/forward.hxx>
6
7#include <art/paperback/carousel/object-model.hxx>
8
10{
11
12 class Writer
13 {
14 public:
15 /// Constructor.
16 ///
17 Writer(ostream&, int, int);
18
19 /// Access the underlying output stream.
20 ///
21 ostream&
22 output();
23
24 /// Write a COS-file header.
25 ///
26 void
27 write_header(string const&);
28
29 /// Write an object.
30 ///
31 void
33
34 /// Begin a new cross-reference table.
35 ///
36 void
37 begin_xref();
38
39 /// Begin a new cross-reference table chunk.
40 ///
41 void
42 begin_xref_chunk(Index, uint16_t);
43
44 /// Write a used entry.
45 ///
46 void
48
49 /// Write a free entry.
50 ///
51 void
53
54 /// Write a COS-file trailer.
55 ///
56 void
58
59 /// Write an EOF marker.
60 ///
61 void
62 write_eof(streamoff);
63
64 private:
65 /// Emit a reference to an indirect object.
66 ///
67 void
69
70 /// Emit undefined.
71 ///
72 void
73 emit(Undefined const&);
74
75 /// Emit a boolean object.
76 ///
77 void
78 emit(Boolean const&);
79
80 /// Emit an integer object.
81 ///
82 void
83 emit(Integer const&);
84
85 /// Emit a real object.
86 ///
87 void
88 emit(Real const&);
89
90 /// Emit a text object.
91 ///
92 void
93 emit(Text const&);
94
95 /// Emit a name object.
96 ///
97 void
98 emit(Name const&);
99
100 /// Emit an array object.
101 ///
102 void
103 emit(Array const&);
104
105 /// Emit a dictionary object.
106 ///
107 void
108 emit(Dictionary const&);
109
110 /// Dispatch the emission of an object.
111 ///
112 void
113 dispatch_emit(Object const&);
114
115 /// Dispatch the emission of an object.
116 ///
117 void
119
120 /// Write a new line marker.
121 ///
122 void
123 new_line();
124
125 private:
126 Writer(Writer const&) = delete;
127 Writer(Writer&&) = delete;
128 Writer& operator=(Writer const&) = delete;
129 Writer& operator=(Writer&&) = delete;
130
131 private:
132 ostream& _output;
133 int _major{};
134 int _minor{};
135
136 string::size_type _indent{};
137
138 };
139
140} // namespace Art::Paperback::Carousel
141
142#endif
Definition array.hxx:14
Represents a COS boolean.
Definition boolean.hxx:16
Represents a COS dictionary.
Definition dictionary.hxx:17
Represents a COS integer.
Definition integer.hxx:16
Represents a COS name.
Definition name.hxx:16
Base class for containers.
Definition object-model.hxx:82
Represents a COS-file object.
Definition object.hxx:16
Represents a COS real.
Definition real.hxx:16
Represents COS text.
Definition text.hxx:16
Definition undefined.hxx:14
Writer(ostream &, int, int)
Constructor.
Definition writer.cxx:29
void write_xref_free_entry(Index, Generation)
Write a free entry.
Definition writer.cxx:120
void write_eof(streamoff)
Write an EOF marker.
Definition writer.cxx:147
void write_xref_used_entry(streamoff, Generation)
Write a used entry.
Definition writer.cxx:103
void emit(Undefined const &)
Emit undefined.
Definition writer.cxx:166
void dispatch_emit(Object const &)
Dispatch the emission of an object.
Definition writer.cxx:384
void begin_xref()
Begin a new cross-reference table.
Definition writer.cxx:83
void begin_xref_chunk(Index, uint16_t)
Begin a new cross-reference table chunk.
Definition writer.cxx:93
void emit_reference(Identity const &)
Emit a reference to an indirect object.
Definition writer.cxx:159
ostream & output()
Access the underlying output stream.
Definition writer.cxx:39
void write_header(string const &)
Write a COS-file header.
Definition writer.cxx:52
void new_line()
Write a new line marker.
Definition writer.cxx:482
void write_trailer(Dictionary const &)
Write a COS-file trailer.
Definition writer.cxx:136
void write_object(Identity const &, Object_model::Container_base const &)
Write an object.
Definition writer.cxx:62
COS file format implementation namespace.
Definition array.cxx:6
uint16_t Generation
Generation type.
Definition types.hxx:76
uint32_t Index
Index type.
Definition types.hxx:72
Represents the identity of an indirect object.
Definition types.hxx:81