diff options
author | Mike Buland <eichlan@xagasoft.com> | 2016-09-22 09:48:01 -0600 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2016-09-22 09:48:01 -0600 |
commit | d44ece9babc5d70e1194a29a54b72dae1fe70ceb (patch) | |
tree | 6ca4f002e08f14845323c4097bcca592bb46f5f1 /src/unstable/teestream.cpp | |
parent | a612205584558c52ae2fedd616d7eb735d5ba84a (diff) | |
download | libbu++-d44ece9babc5d70e1194a29a54b72dae1fe70ceb.tar.gz libbu++-d44ece9babc5d70e1194a29a54b72dae1fe70ceb.tar.bz2 libbu++-d44ece9babc5d70e1194a29a54b72dae1fe70ceb.tar.xz libbu++-d44ece9babc5d70e1194a29a54b72dae1fe70ceb.zip |
Included the experimental TeeStream.
This allows you to write data to multiple streams simultaneously and
easily. It's pretty much complete, but it feels like it could use
more...features somehow.
Diffstat (limited to 'src/unstable/teestream.cpp')
-rw-r--r-- | src/unstable/teestream.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/unstable/teestream.cpp b/src/unstable/teestream.cpp new file mode 100644 index 0000000..52802ef --- /dev/null +++ b/src/unstable/teestream.cpp | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | Bu::TeeStream::* Copyright (C) 2007-2014 Xagasoft, All rights reserved. | ||
3 | Bu::TeeStream::* | ||
4 | Bu::TeeStream::* This file is part of the libbu++ library and is released under the | ||
5 | Bu::TeeStream::* terms of the license contained in the file LICENSE. | ||
6 | Bu::TeeStream::*/ | ||
7 | |||
8 | #include "bu/teestream.h" | ||
9 | |||
10 | Bu::TeeStream::TeeStream() | ||
11 | { | ||
12 | } | ||
13 | |||
14 | Bu::TeeStream::~TeeStream() | ||
15 | { | ||
16 | } | ||
17 | |||
18 | void Bu::TeeStream::addStream( Bu::Stream &rStream ) | ||
19 | { | ||
20 | lStream.append( StreamWrapper( rStream ) ); | ||
21 | } | ||
22 | |||
23 | #define delegate \ | ||
24 | for( StreamRefList::iterator i = lStream.begin(); i; i++ ) \ | ||
25 | (*i).rStream | ||
26 | |||
27 | void Bu::TeeStream::close() | ||
28 | { | ||
29 | delegate.close(); | ||
30 | } | ||
31 | |||
32 | Bu::size Bu::TeeStream::tell() | ||
33 | { | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | void Bu::TeeStream::seek( Bu::size ) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | void Bu::TeeStream::setPos( Bu::size ) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | void Bu::TeeStream::setPosEnd( Bu::size ) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | bool Bu::TeeStream::isEos() | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | bool Bu::TeeStream::isOpen() | ||
55 | { | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | void Bu::TeeStream::flush() | ||
60 | { | ||
61 | delegate.flush(); | ||
62 | } | ||
63 | |||
64 | bool Bu::TeeStream::canRead() | ||
65 | { | ||
66 | return false; | ||
67 | } | ||
68 | |||
69 | bool Bu::TeeStream::canWrite() | ||
70 | { | ||
71 | return true; | ||
72 | } | ||
73 | |||
74 | bool Bu::TeeStream::isReadable() | ||
75 | { | ||
76 | return false; | ||
77 | } | ||
78 | |||
79 | bool Bu::TeeStream::isWritable() | ||
80 | { | ||
81 | return true; | ||
82 | } | ||
83 | |||
84 | bool Bu::TeeStream::isSeekable() | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | |||
89 | bool Bu::TeeStream::isBlocking() | ||
90 | { | ||
91 | return true; | ||
92 | } | ||
93 | |||
94 | void Bu::TeeStream::setBlocking( bool bBlocking ) | ||
95 | { | ||
96 | delegate.setBlocking( bBlocking ); | ||
97 | } | ||
98 | |||
99 | void Bu::TeeStream::setSize( Bu::size ) | ||
100 | { | ||
101 | } | ||
102 | |||
103 | Bu::size Bu::TeeStream::getSize() const | ||
104 | { | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | Bu::size Bu::TeeStream::getBlockSize() const | ||
109 | { | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | Bu::String Bu::TeeStream::getLocation() const | ||
114 | { | ||
115 | return "Invalid"; | ||
116 | } | ||
117 | |||