diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
commit | 469bbcf0701e1eb8a6670c23145b0da87357e178 (patch) | |
tree | b5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/stable/nullstream.cpp | |
parent | ee1b79396076edc4e30aefb285fada03bb45e80d (diff) | |
download | libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2 libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip |
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'src/stable/nullstream.cpp')
-rw-r--r-- | src/stable/nullstream.cpp | 127 |
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 | |||
10 | Bu::NullStream::NullStream() : | ||
11 | sRead( 0 ), | ||
12 | sWrote( 0 ) | ||
13 | { | ||
14 | } | ||
15 | |||
16 | Bu::NullStream::~NullStream() | ||
17 | { | ||
18 | } | ||
19 | |||
20 | void Bu::NullStream::close() | ||
21 | { | ||
22 | sRead = sWrote = 0; | ||
23 | } | ||
24 | |||
25 | Bu::size Bu::NullStream::read( void *pBuf, Bu::size nBytes ) | ||
26 | { | ||
27 | memset( pBuf, 0, nBytes ); | ||
28 | sRead += nBytes; | ||
29 | return nBytes; | ||
30 | } | ||
31 | |||
32 | Bu::String Bu::NullStream::readLine() | ||
33 | { | ||
34 | sRead++; | ||
35 | return Bu::String("\0", 1 ); | ||
36 | } | ||
37 | |||
38 | Bu::size Bu::NullStream::write( const void *, Bu::size nBytes ) | ||
39 | { | ||
40 | sWrote += nBytes; | ||
41 | return nBytes; | ||
42 | } | ||
43 | |||
44 | Bu::size Bu::NullStream::tell() | ||
45 | { | ||
46 | return sRead + sWrote; | ||
47 | } | ||
48 | |||
49 | void Bu::NullStream::seek( Bu::size ) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | void Bu::NullStream::setPos( Bu::size ) | ||
54 | { | ||
55 | } | ||
56 | |||
57 | void Bu::NullStream::setPosEnd( Bu::size ) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | bool Bu::NullStream::isEos() | ||
62 | { | ||
63 | return false; | ||
64 | } | ||
65 | |||
66 | bool Bu::NullStream::isOpen() | ||
67 | { | ||
68 | return true; | ||
69 | } | ||
70 | |||
71 | void Bu::NullStream::flush() | ||
72 | { | ||
73 | } | ||
74 | |||
75 | bool Bu::NullStream::canRead() | ||
76 | { | ||
77 | return true; | ||
78 | } | ||
79 | |||
80 | bool Bu::NullStream::canWrite() | ||
81 | { | ||
82 | return true; | ||
83 | } | ||
84 | |||
85 | bool Bu::NullStream::isReadable() | ||
86 | { | ||
87 | return true; | ||
88 | } | ||
89 | |||
90 | bool Bu::NullStream::isWritable() | ||
91 | { | ||
92 | return true; | ||
93 | } | ||
94 | |||
95 | bool Bu::NullStream::isSeekable() | ||
96 | { | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | bool Bu::NullStream::isBlocking() | ||
101 | { | ||
102 | return true; | ||
103 | } | ||
104 | |||
105 | void Bu::NullStream::setBlocking( bool ) | ||
106 | { | ||
107 | } | ||
108 | |||
109 | void Bu::NullStream::setSize( Bu::size ) | ||
110 | { | ||
111 | } | ||
112 | |||
113 | Bu::size Bu::NullStream::getSize() const | ||
114 | { | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | Bu::size Bu::NullStream::getBlockSize() const | ||
119 | { | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | Bu::String Bu::NullStream::getLocation() const | ||
124 | { | ||
125 | return ""; | ||
126 | } | ||
127 | |||