aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/teestream.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2016-09-22 09:48:01 -0600
committerMike Buland <eichlan@xagasoft.com>2016-09-22 09:48:01 -0600
commitd44ece9babc5d70e1194a29a54b72dae1fe70ceb (patch)
tree6ca4f002e08f14845323c4097bcca592bb46f5f1 /src/unstable/teestream.h
parenta612205584558c52ae2fedd616d7eb735d5ba84a (diff)
downloadlibbu++-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 '')
-rw-r--r--src/unstable/teestream.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/unstable/teestream.h b/src/unstable/teestream.h
new file mode 100644
index 0000000..f7287f1
--- /dev/null
+++ b/src/unstable/teestream.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2007-2014 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_TEE_STREAM_H
9#define BU_TEE_STREAM_H
10
11#include "bu/filter.h"
12
13namespace Bu
14{
15 class TeeStream : public Bu::Stream
16 {
17 public:
18 TeeStream();
19 virtual ~TeeStream();
20
21 void addStream( Bu::Stream &rStream );
22
23 virtual void close();
24 virtual Bu::size tell();
25 virtual void seek( Bu::size offset );
26 virtual void setPos( Bu::size pos );
27 virtual void setPosEnd( Bu::size pos );
28 virtual bool isEos();
29 virtual bool isOpen();
30
31 virtual void flush();
32
33 virtual bool canRead();
34 virtual bool canWrite();
35
36 virtual bool isReadable();
37 virtual bool isWritable();
38 virtual bool isSeekable();
39
40 virtual bool isBlocking();
41 virtual void setBlocking( bool bBlocking=true );
42
43 /**
44 * Most filters won't re-implement this, it doesn't make a lot of sense
45 * for filters, in general.
46 */
47 virtual void setSize( Bu::size iSize );
48
49 virtual size getSize() const;
50 virtual size getBlockSize() const;
51 virtual Bu::String getLocation() const;
52
53 private:
54 class StreamWrapper
55 {
56 public:
57 StreamWrapper( Bu::Stream &r ) : rStream( r ) { }
58 Bu::Stream &rStream;
59 };
60 typedef Bu::List<StreamWrapper> StreamRefList;
61 StreamRefList lStream;
62 };
63}
64
65#endif