Qt Cryptographic Architecture: qca_textfilter.h Source File

Qt Cryptographic Architecture

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

qca_textfilter.h
Go to the documentation of this file.
1 /*
2 * qca_textfilter.h - Qt Cryptographic Architecture
3 * Copyright (C) 2003-2005 Justin Karneges <justin@affinix.com>
4 * Copyright (C) 2004,2005 Brad Hards <bradh@frogmouth.net>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 */
22
33 #ifndef QCA_TEXTFILTER_H
34 #define QCA_TEXTFILTER_H
35
36 #include "qca_core.h"
37
38 namespace QCA {
39
51 class QCA_EXPORT TextFilter : public Filter
52 {
53 public:
60 TextFilter(Direction dir);
61
68 void setup(Direction dir);
69
73 Direction direction() const;
74
86 MemoryRegion encode(const MemoryRegion &a);
87
99 MemoryRegion decode(const MemoryRegion &a);
100
111 QString arrayToString(const MemoryRegion &a);
112
123 MemoryRegion stringToArray(const QString &s);
124
135 QString encodeString(const QString &s);
136
147 QString decodeString(const QString &s);
148
149 protected:
154 Direction _dir;
155 };
156
164 class QCA_EXPORT Hex : public TextFilter
165 {
166 public:
175 Hex(Direction dir = Encode);
176
182 virtual void clear();
183
198 virtual MemoryRegion update(const MemoryRegion &a);
199
208 virtual MemoryRegion final();
209
215 virtual bool ok() const;
216
217 private:
218 Q_DISABLE_COPY(Hex)
219
220 uchar val;
221 bool partial;
222 bool _ok;
223 };
224
232 class QCA_EXPORT Base64 : public TextFilter
233 {
234 public:
243 Base64(Direction dir = Encode);
244
248 bool lineBreaksEnabled() const;
249
253 int lineBreaksColumn() const;
254
263 void setLineBreaksEnabled(bool b);
264
271 void setLineBreaksColumn(int column);
272
277 virtual void clear();
278
293 virtual MemoryRegion update(const MemoryRegion &a);
294
303 virtual MemoryRegion final();
304
310 virtual bool ok() const;
311
312 private:
313 Q_DISABLE_COPY(Base64)
314
315 QByteArray partial;
316 bool _ok;
317 int col;
318 bool _lb_enabled;
319 int _lb_column;
320
321 class Private;
322 Private *d;
323 };
324
325 }
326
327 #endif
QCA::Base64
Base64 encoding / decoding
Definition: qca_textfilter.h:232
QCA::TextFilter::_dir
Direction _dir
Internal state variable for the Direction that the filter operates in.
Definition: qca_textfilter.h:154
qca_core.h
Header file for core QCA infrastructure.
QCA::Direction
Direction
Direction settings for symmetric algorithms.
Definition: qca_core.h:139
QCA
QCA - the Qt Cryptographic Architecture.
Definition: qca_basic.h:45
QCA::Encode
Operate in the "forward" direction; for example, encrypting.
Definition: qca_core.h:141
QCA::Filter
General superclass for filtering transformation algorithms.
Definition: qca_core.h:1065
QCA::TextFilter
Superclass for text based filtering algorithms.
Definition: qca_textfilter.h:51
QCA::Hex
Hexadecimal encoding / decoding.
Definition: qca_textfilter.h:164
QCA::MemoryRegion
Array of bytes that may be optionally secured.
Definition: qca_tools.h:90