forked from psemiletov/tea-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tio.h
238 lines (152 loc) · 2.76 KB
/
tio.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#ifndef TIO_H
#define TIO_H
#include <vector>
#include <QObject>
#include <QList>
#include <QByteArray>
#include <QString>
#include <QStringList>
class CSignaturesList: public QObject
{
Q_OBJECT
public:
QString encname;
QList <QByteArray> words;
};
class CCharsetMagic: public QObject
{
Q_OBJECT
public:
std::vector <CSignaturesList*> signatures;
CCharsetMagic();
~CCharsetMagic();
QString guess_for_file (const QString &fname);
};
class CTio: public QObject
{
Q_OBJECT
public:
bool ronly;
QString data;
QString charset;
QString error_string;
QString eol;
QStringList extensions;
virtual bool load (const QString &fname) = 0;
virtual bool save (const QString &fname) = 0;
virtual ~CTio() {};
};
class CTioPlainText: public CTio
{
Q_OBJECT
public:
CTioPlainText();
bool load (const QString &fname);
bool save (const QString &fname);
};
class CTioReadOnly: public CTio
{
Q_OBJECT
public:
bool save (const QString &fname);
};
class CTioGzip: public CTioReadOnly
{
Q_OBJECT
public:
CTioGzip();
bool load (const QString &fname);
};
class CTioXMLZipped: public CTioReadOnly
{
Q_OBJECT
public:
CTioXMLZipped();
bool load (const QString &fname);
};
class CTioEpub: public CTioReadOnly
{
Q_OBJECT
public:
CTioEpub();
bool load (const QString &fname);
};
class CTioODT: public CTioReadOnly
{
Q_OBJECT
public:
CTioODT();
bool load (const QString &fname);
};
class CTioABW: public CTioReadOnly
{
Q_OBJECT
public:
CTioABW();
bool load (const QString &fname);
};
class CTioFB2: public CTioReadOnly
{
Q_OBJECT
public:
CTioFB2();
bool load (const QString &fname);
};
class CTioRTF: public CTioReadOnly
{
Q_OBJECT
public:
CTioRTF();
bool load (const QString &fname);
};
#if defined(POPPLER_ENABLE)
class CTioPDF: public CTioReadOnly
{
Q_OBJECT
public:
CTioPDF();
bool load (const QString &fname);
};
#endif
#if defined(DJVU_ENABLE)
class CTioDJVU: public CTioReadOnly
{
Q_OBJECT
public:
CTioDJVU();
bool load (const QString &fname);
};
#endif
class CTioHandler: public QObject
{
Q_OBJECT
public:
std::vector <CTio *> list;
CTioPlainText *default_handler;
CTioHandler();
~CTioHandler();
CTio* get_for_fname (const QString &fname);
QStringList get_supported_exts();
};
/*
class CCharsetConverter
{
Q_OBJECT
public:
static virtual QStringList get_charsets() = 0;
virtual ~CCharsetConverter() {};
};
*/
/*
class CIconvCharsetConverter: public QObject
{
Q_OBJECT
public:
QStringList charsets;
QStringList charsets_for_locale (const QString &loc);
void load_charsets();
QString to_utf16 (const QString &enc_from, char *inbuf, int len);
// char* from_utf_16 (const QString &enc_to, const QString &data);
};
*/
#endif // TIO_H