aboutsummaryrefslogtreecommitdiff
path: root/src/stable/staticmembuf.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/staticmembuf.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/stable/staticmembuf.cpp b/src/stable/staticmembuf.cpp
index d470916..43f098b 100644
--- a/src/stable/staticmembuf.cpp
+++ b/src/stable/staticmembuf.cpp
@@ -10,9 +10,9 @@
10using namespace Bu; 10using namespace Bu;
11 11
12Bu::StaticMemBuf::StaticMemBuf( const void *pData, size iSize ) : 12Bu::StaticMemBuf::StaticMemBuf( const void *pData, size iSize ) :
13 pData( pData ), 13 pData( pData ),
14 iSize( iSize ), 14 iSize( iSize ),
15 nPos( 0 ) 15 nPos( 0 )
16{ 16{
17} 17}
18 18
@@ -26,54 +26,54 @@ void Bu::StaticMemBuf::close()
26 26
27size Bu::StaticMemBuf::read( void *pBuf, size nBytes ) 27size Bu::StaticMemBuf::read( void *pBuf, size nBytes )
28{ 28{
29 if( iSize-nPos < nBytes ) 29 if( iSize-nPos < nBytes )
30 nBytes = iSize-nPos; 30 nBytes = iSize-nPos;
31 31
32 memcpy( pBuf, ((char *)pData)+nPos, nBytes ); 32 memcpy( pBuf, ((char *)pData)+nPos, nBytes );
33 nPos += nBytes; 33 nPos += nBytes;
34 34
35 return nBytes; 35 return nBytes;
36} 36}
37 37
38size Bu::StaticMemBuf::write( const void *, size ) 38size Bu::StaticMemBuf::write( const void *, size )
39{ 39{
40 return -1; 40 return -1;
41} 41}
42 42
43size Bu::StaticMemBuf::tell() 43size Bu::StaticMemBuf::tell()
44{ 44{
45 return nPos; 45 return nPos;
46} 46}
47 47
48void Bu::StaticMemBuf::seek( size offset ) 48void Bu::StaticMemBuf::seek( size offset )
49{ 49{
50 nPos += offset; 50 nPos += offset;
51 if( nPos < 0 ) nPos = 0; 51 if( nPos < 0 ) nPos = 0;
52 else if( nPos > iSize ) nPos = iSize; 52 else if( nPos > iSize ) nPos = iSize;
53} 53}
54 54
55void Bu::StaticMemBuf::setPos( size pos ) 55void Bu::StaticMemBuf::setPos( size pos )
56{ 56{
57 nPos = pos; 57 nPos = pos;
58 if( nPos < 0 ) nPos = 0; 58 if( nPos < 0 ) nPos = 0;
59 else if( nPos > iSize ) nPos = iSize; 59 else if( nPos > iSize ) nPos = iSize;
60} 60}
61 61
62void Bu::StaticMemBuf::setPosEnd( size pos ) 62void Bu::StaticMemBuf::setPosEnd( size pos )
63{ 63{
64 nPos = iSize-pos; 64 nPos = iSize-pos;
65 if( nPos < 0 ) nPos = 0; 65 if( nPos < 0 ) nPos = 0;
66 else if( nPos > iSize ) nPos = iSize; 66 else if( nPos > iSize ) nPos = iSize;
67} 67}
68 68
69bool Bu::StaticMemBuf::isEos() 69bool Bu::StaticMemBuf::isEos()
70{ 70{
71 return (nPos == iSize); 71 return (nPos == iSize);
72} 72}
73 73
74bool Bu::StaticMemBuf::isOpen() 74bool Bu::StaticMemBuf::isOpen()
75{ 75{
76 return true; 76 return true;
77} 77}
78 78
79void Bu::StaticMemBuf::flush() 79void Bu::StaticMemBuf::flush()
@@ -82,32 +82,32 @@ void Bu::StaticMemBuf::flush()
82 82
83bool Bu::StaticMemBuf::canRead() 83bool Bu::StaticMemBuf::canRead()
84{ 84{
85 return !isEos(); 85 return !isEos();
86} 86}
87 87
88bool Bu::StaticMemBuf::canWrite() 88bool Bu::StaticMemBuf::canWrite()
89{ 89{
90 return false; 90 return false;
91} 91}
92 92
93bool Bu::StaticMemBuf::isReadable() 93bool Bu::StaticMemBuf::isReadable()
94{ 94{
95 return true; 95 return true;
96} 96}
97 97
98bool Bu::StaticMemBuf::isWritable() 98bool Bu::StaticMemBuf::isWritable()
99{ 99{
100 return false; 100 return false;
101} 101}
102 102
103bool Bu::StaticMemBuf::isSeekable() 103bool Bu::StaticMemBuf::isSeekable()
104{ 104{
105 return true; 105 return true;
106} 106}
107 107
108bool Bu::StaticMemBuf::isBlocking() 108bool Bu::StaticMemBuf::isBlocking()
109{ 109{
110 return true; 110 return true;
111} 111}
112 112
113void Bu::StaticMemBuf::setBlocking( bool ) 113void Bu::StaticMemBuf::setBlocking( bool )
@@ -120,16 +120,16 @@ void Bu::StaticMemBuf::setSize( size )
120 120
121Bu::size Bu::StaticMemBuf::getSize() const 121Bu::size Bu::StaticMemBuf::getSize() const
122{ 122{
123 return iSize; 123 return iSize;
124} 124}
125 125
126Bu::size Bu::StaticMemBuf::getBlockSize() const 126Bu::size Bu::StaticMemBuf::getBlockSize() const
127{ 127{
128 return iSize; 128 return iSize;
129} 129}
130 130
131Bu::String Bu::StaticMemBuf::getLocation() const 131Bu::String Bu::StaticMemBuf::getLocation() const
132{ 132{
133 return ""; 133 return "";
134} 134}
135 135