1 | /* This file is part of the KDE libraries |
---|---|
2 | SPDX-FileCopyrightText: 2000-2005 David Faure <faure@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #include "kfilterbase.h" |
8 | |
9 | #include <QIODevice> |
10 | |
11 | class KFilterBasePrivate |
12 | { |
13 | public: |
14 | KFilterBasePrivate() |
15 | : m_flags(KFilterBase::WithHeaders) |
16 | , m_dev(nullptr) |
17 | , m_bAutoDel(false) |
18 | { |
19 | } |
20 | KFilterBase::FilterFlags m_flags; |
21 | QIODevice *m_dev; |
22 | bool m_bAutoDel; |
23 | }; |
24 | |
25 | KFilterBase::KFilterBase() |
26 | : d(new KFilterBasePrivate) |
27 | { |
28 | } |
29 | |
30 | KFilterBase::~KFilterBase() |
31 | { |
32 | if (d->m_bAutoDel) { |
33 | delete d->m_dev; |
34 | } |
35 | delete d; |
36 | } |
37 | |
38 | void KFilterBase::setDevice(QIODevice *dev, bool autodelete) |
39 | { |
40 | d->m_dev = dev; |
41 | d->m_bAutoDel = autodelete; |
42 | } |
43 | |
44 | QIODevice *KFilterBase::device() |
45 | { |
46 | return d->m_dev; |
47 | } |
48 | |
49 | bool KFilterBase::inBufferEmpty() const |
50 | { |
51 | return inBufferAvailable() == 0; |
52 | } |
53 | |
54 | bool KFilterBase::outBufferFull() const |
55 | { |
56 | return outBufferAvailable() == 0; |
57 | } |
58 | |
59 | bool KFilterBase::terminate() |
60 | { |
61 | return true; |
62 | } |
63 | |
64 | void KFilterBase::reset() |
65 | { |
66 | } |
67 | |
68 | void KFilterBase::setFilterFlags(FilterFlags flags) |
69 | { |
70 | d->m_flags = flags; |
71 | } |
72 | |
73 | KFilterBase::FilterFlags KFilterBase::filterFlags() const |
74 | { |
75 | return d->m_flags; |
76 | } |
77 | |
78 | void KFilterBase::virtual_hook(int, void *) |
79 | { |
80 | /*BASE::virtual_hook( id, data );*/ |
81 | } |
82 |