aboutsummaryrefslogtreecommitdiff
path: root/src/stable/nullstream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stable/nullstream.cpp')
-rw-r--r--src/stable/nullstream.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/src/stable/nullstream.cpp b/src/stable/nullstream.cpp
new file mode 100644
index 0000000..9552cc5
--- /dev/null
+++ b/src/stable/nullstream.cpp
@@ -0,0 +1,127 @@
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#include "bu/nullstream.h"
9
10Bu::NullStream::NullStream() :
11 sRead( 0 ),
12 sWrote( 0 )
13{
14}
15
16Bu::NullStream::~NullStream()
17{
18}
19
20void Bu::NullStream::close()
21{
22 sRead = sWrote = 0;
23}
24
25Bu::size Bu::NullStream::read( void *pBuf, Bu::size nBytes )
26{
27 memset( pBuf, 0, nBytes );
28 sRead += nBytes;
29 return nBytes;
30}
31
32Bu::String Bu::NullStream::readLine()
33{
34 sRead++;
35 return Bu::String("\0", 1 );
36}
37
38Bu::size Bu::NullStream::write( const void *, Bu::size nBytes )
39{
40 sWrote += nBytes;
41 return nBytes;
42}
43
44Bu::size Bu::NullStream::tell()
45{
46 return sRead + sWrote;
47}
48
49void Bu::NullStream::seek( Bu::size )
50{
51}
52
53void Bu::NullStream::setPos( Bu::size )
54{
55}
56
57void Bu::NullStream::setPosEnd( Bu::size )
58{
59}
60
61bool Bu::NullStream::isEos()
62{
63 return false;
64}
65
66bool Bu::NullStream::isOpen()
67{
68 return true;
69}
70
71void Bu::NullStream::flush()
72{
73}
74
75bool Bu::NullStream::canRead()
76{
77 return true;
78}
79
80bool Bu::NullStream::canWrite()
81{
82 return true;
83}
84
85bool Bu::NullStream::isReadable()
86{
87 return true;
88}
89
90bool Bu::NullStream::isWritable()
91{
92 return true;
93}
94
95bool Bu::NullStream::isSeekable()
96{
97 return false;
98}
99
100bool Bu::NullStream::isBlocking()
101{
102 return true;
103}
104
105void Bu::NullStream::setBlocking( bool )
106{
107}
108
109void Bu::NullStream::setSize( Bu::size )
110{
111}
112
113Bu::size Bu::NullStream::getSize() const
114{
115 return 0;
116}
117
118Bu::size Bu::NullStream::getBlockSize() const
119{
120 return 0;
121}
122
123Bu::String Bu::NullStream::getLocation() const
124{
125 return "";
126}
127