aboutsummaryrefslogtreecommitdiff
path: root/src/stable/nullstream.cpp
blob: 83b38ab9ba79d89418c306d2556808c47c1dc578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 * Copyright (C) 2007-2019 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#include "bu/nullstream.h"

Bu::NullStream::NullStream() :
    sRead( 0 ),
    sWrote( 0 )
{
}

Bu::NullStream::~NullStream()
{
}

void Bu::NullStream::close()
{
    sRead = sWrote = 0;
}

Bu::size Bu::NullStream::read( void *pBuf, Bu::size nBytes )
{
    memset( pBuf, 0, nBytes );
    sRead += nBytes;
    return nBytes;
}

Bu::String Bu::NullStream::readLine()
{
    sRead++;
    return Bu::String("\0", 1 );
}

Bu::size Bu::NullStream::write( const void *, Bu::size nBytes )
{
    sWrote += nBytes;
    return nBytes;
}

Bu::size Bu::NullStream::tell()
{
    return sRead + sWrote;
}

void Bu::NullStream::seek( Bu::size )
{
}

void Bu::NullStream::setPos( Bu::size )
{
}

void Bu::NullStream::setPosEnd( Bu::size )
{
}

bool Bu::NullStream::isEos()
{
    return false;
}

bool Bu::NullStream::isOpen()
{
    return true;
}

void Bu::NullStream::flush()
{
}

bool Bu::NullStream::canRead()
{
    return true;
}

bool Bu::NullStream::canWrite()
{
    return true;
}

bool Bu::NullStream::isReadable()
{
    return true;
}

bool Bu::NullStream::isWritable()
{
    return true;
}

bool Bu::NullStream::isSeekable()
{
    return false;
}

bool Bu::NullStream::isBlocking()
{
    return true;
}

void Bu::NullStream::setBlocking( bool )
{
}

void Bu::NullStream::setSize( Bu::size )
{
}

Bu::size Bu::NullStream::getSize() const
{
    return 0;
}

Bu::size Bu::NullStream::getBlockSize() const
{
    return 0;
}

Bu::String Bu::NullStream::getLocation() const
{
    return "";
}