diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-11-19 09:39:24 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-11-19 09:39:24 +0000 |
commit | b5b68088f28b2593bfbf910a46fd52775007e8b3 (patch) | |
tree | 254a04b68ee1a8f8e2070fe10162d6ad0cea1620 /src/stdstream.cpp | |
parent | 305d608fe508b8e2c31df9282cc6f987260a76b1 (diff) | |
download | libbu++-b5b68088f28b2593bfbf910a46fd52775007e8b3.tar.gz libbu++-b5b68088f28b2593bfbf910a46fd52775007e8b3.tar.bz2 libbu++-b5b68088f28b2593bfbf910a46fd52775007e8b3.tar.xz libbu++-b5b68088f28b2593bfbf910a46fd52775007e8b3.zip |
Added the Bu::StdStream Stream class, it's just a wrapper for writing to,
reading from standard output/input.
Diffstat (limited to '')
-rw-r--r-- | src/stdstream.cpp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/stdstream.cpp b/src/stdstream.cpp new file mode 100644 index 0000000..1ddb3c1 --- /dev/null +++ b/src/stdstream.cpp | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 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/stdstream.h" | ||
9 | |||
10 | Bu::StdStream::StdStream() | ||
11 | { | ||
12 | } | ||
13 | |||
14 | Bu::StdStream::~StdStream() | ||
15 | { | ||
16 | } | ||
17 | |||
18 | void Bu::StdStream::close() | ||
19 | { | ||
20 | } | ||
21 | |||
22 | size_t Bu::StdStream::read( void *pBuf, size_t nBytes ) | ||
23 | { | ||
24 | return fread( pBuf, 1, nBytes, stdin ); | ||
25 | } | ||
26 | |||
27 | size_t Bu::StdStream::write( const void *pBuf, size_t nBytes ) | ||
28 | { | ||
29 | return fwrite( pBuf, 1, nBytes, stdout ); | ||
30 | } | ||
31 | |||
32 | long Bu::StdStream::tell() | ||
33 | { | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | void Bu::StdStream::seek( long offset ) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | void Bu::StdStream::setPos( long pos ) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | void Bu::StdStream::setPosEnd( long pos ) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | bool Bu::StdStream::isEOS() | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | bool Bu::StdStream::isOpen() | ||
55 | { | ||
56 | return true; | ||
57 | } | ||
58 | |||
59 | void Bu::StdStream::flush() | ||
60 | { | ||
61 | fflush( stdout ); | ||
62 | } | ||
63 | |||
64 | bool Bu::StdStream::canRead() | ||
65 | { | ||
66 | return true; | ||
67 | } | ||
68 | |||
69 | bool Bu::StdStream::canWrite() | ||
70 | { | ||
71 | return true; | ||
72 | } | ||
73 | |||
74 | bool Bu::StdStream::isReadable() | ||
75 | { | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | bool Bu::StdStream::isWritable() | ||
80 | { | ||
81 | return true; | ||
82 | } | ||
83 | |||
84 | bool Bu::StdStream::isSeekable() | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | |||
89 | bool Bu::StdStream::isBlocking() | ||
90 | { | ||
91 | return true; | ||
92 | } | ||
93 | |||
94 | void Bu::StdStream::setBlocking( bool bBlocking ) | ||
95 | { | ||
96 | } | ||
97 | |||