/src/xpdf-4.04/xpdf/TextString.h
Line | Count | Source (jump to first uncovered line) |
1 | | //======================================================================== |
2 | | // |
3 | | // TextString.h |
4 | | // |
5 | | // Copyright 2011-2013 Glyph & Cog, LLC |
6 | | // |
7 | | // Represents a PDF "text string", which can either be a UTF-16BE |
8 | | // string (with a leading byte order marker), or an 8-bit string in |
9 | | // PDFDocEncoding. |
10 | | // |
11 | | //======================================================================== |
12 | | |
13 | | #ifndef TEXTSTRING_H |
14 | | #define TEXTSTRING_H |
15 | | |
16 | | #include <aconf.h> |
17 | | |
18 | | #ifdef USE_GCC_PRAGMAS |
19 | | #pragma interface |
20 | | #endif |
21 | | |
22 | | #include "CharTypes.h" |
23 | | |
24 | | class GString; |
25 | | |
26 | | //------------------------------------------------------------------------ |
27 | | |
28 | | class TextString { |
29 | | public: |
30 | | |
31 | | // Create an empty TextString. |
32 | | TextString(); |
33 | | |
34 | | // Create a TextString from a PDF text string. |
35 | | TextString(GString *s); |
36 | | |
37 | | // Copy a TextString. |
38 | | TextString(TextString *s); |
39 | | |
40 | | ~TextString(); |
41 | | |
42 | | // Append a Unicode character or PDF text string to this TextString. |
43 | | TextString *append(Unicode c); |
44 | | TextString *append(GString *s); |
45 | | |
46 | | // Insert a Unicode character, sequence of Unicode characters, or |
47 | | // PDF text string in this TextString. |
48 | | TextString *insert(int idx, Unicode c); |
49 | | TextString *insert(int idx, Unicode *u2, int n); |
50 | | TextString *insert(int idx, GString *s); |
51 | | |
52 | | // Get the Unicode characters in the TextString. |
53 | 0 | int getLength() { return len; } |
54 | 0 | Unicode *getUnicode() { return u; } |
55 | | |
56 | | // Create a PDF text string from a TextString. |
57 | | GString *toPDFTextString(); |
58 | | |
59 | | // Convert a TextString to UTF-8. |
60 | | GString *toUTF8(); |
61 | | |
62 | | private: |
63 | | |
64 | | void expand(int delta); |
65 | | |
66 | | Unicode *u; // NB: not null-terminated |
67 | | int len; |
68 | | int size; |
69 | | }; |
70 | | |
71 | | #endif |