summaryrefslogtreecommitdiff
path: root/src/nullstream.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-08-04 15:17:11 +0000
committerMike Buland <eichlan@xagasoft.com>2010-08-04 15:17:11 +0000
commita83e9babede7ab5bc8e1ac6c7ee3784b91bd8452 (patch)
treee54db7f9a50e7f9924c5a749a586fbf172cb48ce /src/nullstream.cpp
parent819cfbbc5f8caa65575caefb3e602d2d9f7425b3 (diff)
downloadlibbu++-a83e9babede7ab5bc8e1ac6c7ee3784b91bd8452.tar.gz
libbu++-a83e9babede7ab5bc8e1ac6c7ee3784b91bd8452.tar.bz2
libbu++-a83e9babede7ab5bc8e1ac6c7ee3784b91bd8452.tar.xz
libbu++-a83e9babede7ab5bc8e1ac6c7ee3784b91bd8452.zip
Alright, NullStream compiles and works.
Diffstat (limited to 'src/nullstream.cpp')
-rw-r--r--src/nullstream.cpp114
1 files changed, 94 insertions, 20 deletions
diff --git a/src/nullstream.cpp b/src/nullstream.cpp
index 364b58a..40c636c 100644
--- a/src/nullstream.cpp
+++ b/src/nullstream.cpp
@@ -1,6 +1,8 @@
1#include "bu/nullstream.h" 1#include "bu/nullstream.h"
2 2
3Bu::NullStream::NullStream() 3Bu::NullStream::NullStream() :
4 sRead( 0 ),
5 sWrote( 0 )
4{ 6{
5} 7}
6 8
@@ -8,24 +10,96 @@ Bu::NullStream::~NullStream()
8{ 10{
9} 11}
10 12
11void Bu::NullStream::close(); 13void Bu::NullStream::close()
12size_t Bu::NullStream::read( void *pBuf, size_t nBytes ); 14{
13Bu::FString Bu::NullStream::readLine(); 15 sRead = sWrote = 0;
14size_t Bu::NullStream::write( const void *pBuf, size_t nBytes ); 16}
15long Bu::NullStream::tell(); 17
16void Bu::NullStream::seek( long offset ); 18size_t Bu::NullStream::read( void *pBuf, size_t nBytes )
17void Bu::NullStream::setPos( long pos ); 19{
18void Bu::NullStream::setPosEnd( long pos ); 20 memset( pBuf, 0, nBytes );
19bool Bu::NullStream::isEos(); 21 sRead += nBytes;
20bool Bu::NullStream::isOpen(); 22 return nBytes;
21void Bu::NullStream::flush(); 23}
22bool Bu::NullStream::canRead(); 24
23bool Bu::NullStream::canWrite(); 25Bu::FString Bu::NullStream::readLine()
24bool Bu::NullStream::isReadable(); 26{
25bool Bu::NullStream::isWritable(); 27 sRead++;
26bool Bu::NullStream::isSeekable(); 28 return Bu::FString("\0", 1 );
27bool Bu::NullStream::isBlocking(); 29}
28void Bu::NullStream::setBlocking( bool bBlocking=true ); 30
29void Bu::NullStream::setSize( long iSize ); 31size_t Bu::NullStream::write( const void *, size_t nBytes )
32{
33 sWrote += nBytes;
34 return nBytes;
35}
36
37long Bu::NullStream::tell()
38{
39 return sRead + sWrote;
40}
30 41
42void Bu::NullStream::seek( long )
43{
44}
45
46void Bu::NullStream::setPos( long )
47{
48}
49
50void Bu::NullStream::setPosEnd( long )
51{
52}
53
54bool Bu::NullStream::isEos()
55{
56 return false;
57}
58
59bool Bu::NullStream::isOpen()
60{
61 return true;
62}
63
64void Bu::NullStream::flush()
65{
66}
67
68bool Bu::NullStream::canRead()
69{
70 return true;
71}
72
73bool Bu::NullStream::canWrite()
74{
75 return true;
76}
77
78bool Bu::NullStream::isReadable()
79{
80 return true;
81}
82
83bool Bu::NullStream::isWritable()
84{
85 return true;
86}
87
88bool Bu::NullStream::isSeekable()
89{
90 return false;
91}
92
93bool Bu::NullStream::isBlocking()
94{
95 return true;
96}
97
98void Bu::NullStream::setBlocking( bool )
99{
100}
101
102void Bu::NullStream::setSize( long )
103{
104}
31 105