diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/stable/streamstack.h | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/stable/streamstack.h')
-rw-r--r-- | src/stable/streamstack.h | 250 |
1 files changed, 125 insertions, 125 deletions
diff --git a/src/stable/streamstack.h b/src/stable/streamstack.h index 36c2e11..06a3214 100644 --- a/src/stable/streamstack.h +++ b/src/stable/streamstack.h | |||
@@ -14,131 +14,131 @@ | |||
14 | 14 | ||
15 | namespace Bu | 15 | namespace Bu |
16 | { | 16 | { |
17 | class StreamStack : public Bu::Stream | 17 | class StreamStack : public Bu::Stream |
18 | { | 18 | { |
19 | private: | 19 | private: |
20 | typedef Bu::List<Bu::Stream *> FilterList; | 20 | typedef Bu::List<Bu::Stream *> FilterList; |
21 | 21 | ||
22 | public: | 22 | public: |
23 | StreamStack(); | 23 | StreamStack(); |
24 | StreamStack( Bu::Stream *pStream ); | 24 | StreamStack( Bu::Stream *pStream ); |
25 | virtual ~StreamStack(); | 25 | virtual ~StreamStack(); |
26 | 26 | ||
27 | bool isEmpty(); | 27 | bool isEmpty(); |
28 | bool hasStream(); | 28 | bool hasStream(); |
29 | void setStream( Bu::Stream *pStream ); | 29 | void setStream( Bu::Stream *pStream ); |
30 | 30 | ||
31 | void clear(); | 31 | void clear(); |
32 | void popFilter(); | 32 | void popFilter(); |
33 | Bu::Stream *getTop(); | 33 | Bu::Stream *getTop(); |
34 | 34 | ||
35 | Bu::Stream *getStream(); | 35 | Bu::Stream *getStream(); |
36 | 36 | ||
37 | template<typename filter> | 37 | template<typename filter> |
38 | Bu::Stream *findFilter() | 38 | Bu::Stream *findFilter() |
39 | { | 39 | { |
40 | for( FilterList::iterator i = lFilts.begin(); i; i++ ) | 40 | for( FilterList::iterator i = lFilts.begin(); i; i++ ) |
41 | { | 41 | { |
42 | if( typeid(**i) == typeid( filter ) ) | 42 | if( typeid(**i) == typeid( filter ) ) |
43 | { | 43 | { |
44 | return *i; | 44 | return *i; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | throw Bu::ExceptionBase("Filter not found."); | 48 | throw Bu::ExceptionBase("Filter not found."); |
49 | } | 49 | } |
50 | 50 | ||
51 | template<typename filter> | 51 | template<typename filter> |
52 | void pushFilter() | 52 | void pushFilter() |
53 | { | 53 | { |
54 | checkStack(); | 54 | checkStack(); |
55 | 55 | ||
56 | filter *pFlt = new filter( *lFilts.first() ); | 56 | filter *pFlt = new filter( *lFilts.first() ); |
57 | lFilts.prepend( pFlt ); | 57 | lFilts.prepend( pFlt ); |
58 | } | 58 | } |
59 | 59 | ||
60 | template<typename filter, typename p1t> | 60 | template<typename filter, typename p1t> |
61 | void pushFilter( p1t p1 ) | 61 | void pushFilter( p1t p1 ) |
62 | { | 62 | { |
63 | checkStack(); | 63 | checkStack(); |
64 | 64 | ||
65 | filter *pFlt = new filter( *lFilts.first(), p1 ); | 65 | filter *pFlt = new filter( *lFilts.first(), p1 ); |
66 | lFilts.prepend( pFlt ); | 66 | lFilts.prepend( pFlt ); |
67 | } | 67 | } |
68 | 68 | ||
69 | template<typename filter, typename p1t, typename p2t> | 69 | template<typename filter, typename p1t, typename p2t> |
70 | void pushFilter( p1t p1, p2t p2 ) | 70 | void pushFilter( p1t p1, p2t p2 ) |
71 | { | 71 | { |
72 | checkStack(); | 72 | checkStack(); |
73 | 73 | ||
74 | filter *pFlt = new filter( *lFilts.first(), p1, p2 ); | 74 | filter *pFlt = new filter( *lFilts.first(), p1, p2 ); |
75 | lFilts.prepend( pFlt ); | 75 | lFilts.prepend( pFlt ); |
76 | } | 76 | } |
77 | 77 | ||
78 | template<typename filter, typename p1t, typename p2t, typename p3t> | 78 | template<typename filter, typename p1t, typename p2t, typename p3t> |
79 | void pushFilter( p1t p1, p2t p2, p3t p3 ) | 79 | void pushFilter( p1t p1, p2t p2, p3t p3 ) |
80 | { | 80 | { |
81 | checkStack(); | 81 | checkStack(); |
82 | 82 | ||
83 | filter *pFlt = new filter( *lFilts.first(), p1, p2, p3 ); | 83 | filter *pFlt = new filter( *lFilts.first(), p1, p2, p3 ); |
84 | lFilts.prepend( pFlt ); | 84 | lFilts.prepend( pFlt ); |
85 | } | 85 | } |
86 | 86 | ||
87 | template<typename filter, typename p1t, typename p2t, typename p3t, | 87 | template<typename filter, typename p1t, typename p2t, typename p3t, |
88 | typename p4t> | 88 | typename p4t> |
89 | void pushFilter( p1t p1, p2t p2, p3t p3, p4t p4 ) | 89 | void pushFilter( p1t p1, p2t p2, p3t p3, p4t p4 ) |
90 | { | 90 | { |
91 | checkStack(); | 91 | checkStack(); |
92 | 92 | ||
93 | filter *pFlt = new filter( *lFilts.first(), p1, p2, p3, p4 ); | 93 | filter *pFlt = new filter( *lFilts.first(), p1, p2, p3, p4 ); |
94 | lFilts.prepend( pFlt ); | 94 | lFilts.prepend( pFlt ); |
95 | } | 95 | } |
96 | 96 | ||
97 | template<typename filter, typename p1t, typename p2t, typename p3t, | 97 | template<typename filter, typename p1t, typename p2t, typename p3t, |
98 | typename p4t, typename p5t> | 98 | typename p4t, typename p5t> |
99 | void pushFilter( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) | 99 | void pushFilter( p1t p1, p2t p2, p3t p3, p4t p4, p5t p5 ) |
100 | { | 100 | { |
101 | checkStack(); | 101 | checkStack(); |
102 | 102 | ||
103 | filter *pFlt = new filter( *lFilts.first(), p1, p2, p3, p4, p5 ); | 103 | filter *pFlt = new filter( *lFilts.first(), p1, p2, p3, p4, p5 ); |
104 | lFilts.prepend( pFlt ); | 104 | lFilts.prepend( pFlt ); |
105 | } | 105 | } |
106 | 106 | ||
107 | // | 107 | // |
108 | // Everything below here merely passes on the call to the top of the | 108 | // Everything below here merely passes on the call to the top of the |
109 | // stream stack. | 109 | // stream stack. |
110 | // | 110 | // |
111 | 111 | ||
112 | virtual void close(); | 112 | virtual void close(); |
113 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); | 113 | virtual Bu::size read( void *pBuf, Bu::size nBytes ); |
114 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); | 114 | virtual Bu::size write( const void *pBuf, Bu::size nBytes ); |
115 | 115 | ||
116 | virtual Bu::size write( const Bu::String &sBuf ); | 116 | virtual Bu::size write( const Bu::String &sBuf ); |
117 | virtual Bu::size tell(); | 117 | virtual Bu::size tell(); |
118 | virtual void seek( Bu::size offset ); | 118 | virtual void seek( Bu::size offset ); |
119 | virtual void setPos( Bu::size pos ); | 119 | virtual void setPos( Bu::size pos ); |
120 | virtual void setPosEnd( Bu::size pos ); | 120 | virtual void setPosEnd( Bu::size pos ); |
121 | virtual bool isEos(); | 121 | virtual bool isEos(); |
122 | virtual bool isOpen(); | 122 | virtual bool isOpen(); |
123 | virtual void flush(); | 123 | virtual void flush(); |
124 | virtual bool canRead(); | 124 | virtual bool canRead(); |
125 | virtual bool canWrite(); | 125 | virtual bool canWrite(); |
126 | virtual bool isReadable(); | 126 | virtual bool isReadable(); |
127 | virtual bool isWritable(); | 127 | virtual bool isWritable(); |
128 | virtual bool isSeekable(); | 128 | virtual bool isSeekable(); |
129 | virtual bool isBlocking(); | 129 | virtual bool isBlocking(); |
130 | virtual void setBlocking( bool bBlocking=true ); | 130 | virtual void setBlocking( bool bBlocking=true ); |
131 | virtual void setSize( Bu::size iSize ); | 131 | virtual void setSize( Bu::size iSize ); |
132 | virtual size getSize() const; | 132 | virtual size getSize() const; |
133 | virtual size getBlockSize() const; | 133 | virtual size getBlockSize() const; |
134 | virtual Bu::String getLocation() const; | 134 | virtual Bu::String getLocation() const; |
135 | 135 | ||
136 | private: | 136 | private: |
137 | void checkStack() const; | 137 | void checkStack() const; |
138 | 138 | ||
139 | private: | 139 | private: |
140 | FilterList lFilts; | 140 | FilterList lFilts; |
141 | }; | 141 | }; |
142 | }; | 142 | }; |
143 | 143 | ||
144 | #endif | 144 | #endif |