libart-paperback 0.1.0-a.1.20260122225059.e5fea306241a
PDF (1.4) library for C++
text.hxx
1#ifndef art__paperback__carousel__text_hxx_
2#define art__paperback__carousel__text_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 /// Represents COS text.
13 ///
14 class Text
16 {
17 public:
18 /// Enumeration of text conventions.
19 ///
20 /// See Section 3.2.3, "String Objects" in the PDF-1.4 specification
21 /// for details about text strings and their representation.
22 ///
23 enum class Convention
24 {
25 /// Indicates the literal convention. When used, the text string
26 /// will be written verbatim to the output file, enclosed in
27 /// parentheses.
28 ///
29 /// Special characters will be written as escape-sequences.
30 ///
32
33 /// Indicates the hexadecimal convention. When used, the text
34 /// string will be written as a sequence of hexadecimal digits,
35 /// enclosed within angle brackets.
36 ///
37 /// The size of the written data will be double the length of
38 /// the text string when this convention is used.
39 ///
41
42 };
43
44 /// Constructor.
45 ///
47
48 /// Constructor.
49 ///
51
52 /// Constructor.
53 ///
54 Text(char const*, Convention = Convention::literal);
55
56 /// Constructor.
57 ///
58 Text(Text const&);
59
60 /// Constructor.
61 ///
62 Text(Text&&);
63
64 /// Destructor.
65 ///
66 ~Text() noexcept;
67
68 /// Get the text convention used for this object.
69 ///
71 convention() const;
72
73 /// Access text string.
74 ///
75 string const&
76 operator*() const;
77
78 /// Access text string.
79 ///
80 string const*
81 operator->() const;
82
83 /// Assignment.
84 ///
85 Text&
86 operator=(Text const&);
87
88 /// Assignment.
89 ///
90 Text&
91 operator=(Text&&);
92
93 /// Comparison.
94 ///
95 bool
96 operator==(Text const&) const;
97
98 /// Comparison.
99 ///
100 bool
101 operator!=(Text const&) const;
102
103 /// Comparison.
104 ///
105 bool
106 operator<(Text const&) const;
107
108 /// Comparison.
109 ///
110 bool
111 operator<=(Text const&) const;
112
113 /// Comparison.
114 ///
115 bool
116 operator>(Text const&) const;
117
118 /// Comparison.
119 ///
120 bool
121 operator>=(Text const&) const;
122
123 private:
124 Convention _convention;
125 string _data;
126
127 };
128
129} // namespace Art::Paperback::Carousel
130
131#endif
Base class for value types.
Definition object-model.hxx:295
Represents COS text.
Definition text.hxx:16
Convention
Enumeration of text conventions.
Definition text.hxx:24
@ hexadecimal
Indicates the hexadecimal convention.
Definition text.hxx:40
@ literal
Indicates the literal convention.
Definition text.hxx:31
Convention convention() const
Get the text convention used for this object.
Definition text.cxx:46
~Text() noexcept
Destructor.
Definition text.cxx:41
Text(Convention=Convention::literal)
Constructor.
Definition text.cxx:12
COS file format implementation namespace.
Definition array.cxx:6