diff options
Diffstat (limited to 'src/filter.h')
-rw-r--r-- | src/filter.h | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/filter.h b/src/filter.h deleted file mode 100644 index 2c57805..0000000 --- a/src/filter.h +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_FILTER_H | ||
9 | #define BU_FILTER_H | ||
10 | |||
11 | #include <stdint.h> | ||
12 | |||
13 | #include "bu/stream.h" | ||
14 | |||
15 | namespace Bu | ||
16 | { | ||
17 | /** | ||
18 | * Data filter base class. Each data filter should contain a read and write | ||
19 | * section. Effectively, the write applies the filter, the read un-applies | ||
20 | * the filter, if possible. For example, BZip2 is a filter that compresses | ||
21 | * on write and decompresses on read. All bi-directional filters should | ||
22 | * follow: x == read( write( x ) ) (byte-for-byte comparison) | ||
23 | * | ||
24 | * Also, all returned buffers should be owned by the filter, and deleted | ||
25 | * when the filter is deleted. This means that the output of a read or | ||
26 | * write operation must be used before the next call to read or write or the | ||
27 | * data will be destroyed. Also, the internal buffer may be changed or | ||
28 | * recreated between calls, so always get a new pointer from a call to | ||
29 | * read or write. | ||
30 | * | ||
31 | * The close function can also return data, so make sure to check for it, | ||
32 | * many filters such as compression filters will buffer data until they have | ||
33 | * enough to create a compression block, in these cases the leftover data | ||
34 | * will be returned by close. | ||
35 | *@ingroup Streams | ||
36 | */ | ||
37 | class Filter : public Bu::Stream | ||
38 | { | ||
39 | public: | ||
40 | Filter( Bu::Stream &rNext ); | ||
41 | virtual ~Filter(); | ||
42 | |||
43 | virtual void start()=0; | ||
44 | virtual Bu::size stop()=0; | ||
45 | virtual void close(); | ||
46 | virtual Bu::size tell(); | ||
47 | virtual void seek( Bu::size offset ); | ||
48 | virtual void setPos( Bu::size pos ); | ||
49 | virtual void setPosEnd( Bu::size pos ); | ||
50 | virtual bool isEos(); | ||
51 | virtual bool isOpen(); | ||
52 | |||
53 | virtual void flush(); | ||
54 | |||
55 | virtual bool canRead(); | ||
56 | virtual bool canWrite(); | ||
57 | |||
58 | virtual bool isReadable(); | ||
59 | virtual bool isWritable(); | ||
60 | virtual bool isSeekable(); | ||
61 | |||
62 | virtual bool isBlocking(); | ||
63 | virtual void setBlocking( bool bBlocking=true ); | ||
64 | |||
65 | /** | ||
66 | * Most filters won't re-implement this, it doesn't make a lot of sense | ||
67 | * for filters, in general. | ||
68 | */ | ||
69 | virtual void setSize( Bu::size iSize ); | ||
70 | |||
71 | virtual size getSize() const; | ||
72 | virtual size getBlockSize() const; | ||
73 | virtual Bu::String getLocation() const; | ||
74 | |||
75 | protected: | ||
76 | Bu::Stream &rNext; | ||
77 | |||
78 | private: | ||
79 | |||
80 | }; | ||
81 | } | ||
82 | |||
83 | #endif | ||