aboutsummaryrefslogtreecommitdiff
path: root/src/staticmembuf.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
committerMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
commit469bbcf0701e1eb8a6670c23145b0da87357e178 (patch)
treeb5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/staticmembuf.cpp
parentee1b79396076edc4e30aefb285fada03bb45e80d (diff)
downloadlibbu++-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/staticmembuf.cpp')
-rw-r--r--src/staticmembuf.cpp135
1 files changed, 0 insertions, 135 deletions
diff --git a/src/staticmembuf.cpp b/src/staticmembuf.cpp
deleted file mode 100644
index 74fae31..0000000
--- a/src/staticmembuf.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
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/staticmembuf.h"
9
10using namespace Bu;
11
12Bu::StaticMemBuf::StaticMemBuf( const void *pData, size iSize ) :
13 pData( pData ),
14 iSize( iSize ),
15 nPos( 0 )
16{
17}
18
19Bu::StaticMemBuf::~StaticMemBuf()
20{
21}
22
23void Bu::StaticMemBuf::close()
24{
25}
26
27size Bu::StaticMemBuf::read( void *pBuf, size nBytes )
28{
29 if( iSize-nPos < nBytes )
30 nBytes = iSize-nPos;
31
32 memcpy( pBuf, ((char *)pData)+nPos, nBytes );
33 nPos += nBytes;
34
35 return nBytes;
36}
37
38size Bu::StaticMemBuf::write( const void *, size )
39{
40 return -1;
41}
42
43size Bu::StaticMemBuf::tell()
44{
45 return nPos;
46}
47
48void Bu::StaticMemBuf::seek( size offset )
49{
50 nPos += offset;
51 if( nPos < 0 ) nPos = 0;
52 else if( nPos > iSize ) nPos = iSize;
53}
54
55void Bu::StaticMemBuf::setPos( size pos )
56{
57 nPos = pos;
58 if( nPos < 0 ) nPos = 0;
59 else if( nPos > iSize ) nPos = iSize;
60}
61
62void Bu::StaticMemBuf::setPosEnd( size pos )
63{
64 nPos = iSize-pos;
65 if( nPos < 0 ) nPos = 0;
66 else if( nPos > iSize ) nPos = iSize;
67}
68
69bool Bu::StaticMemBuf::isEos()
70{
71 return (nPos == iSize);
72}
73
74bool Bu::StaticMemBuf::isOpen()
75{
76 return true;
77}
78
79void Bu::StaticMemBuf::flush()
80{
81}
82
83bool Bu::StaticMemBuf::canRead()
84{
85 return !isEos();
86}
87
88bool Bu::StaticMemBuf::canWrite()
89{
90 return false;
91}
92
93bool Bu::StaticMemBuf::isReadable()
94{
95 return true;
96}
97
98bool Bu::StaticMemBuf::isWritable()
99{
100 return false;
101}
102
103bool Bu::StaticMemBuf::isSeekable()
104{
105 return true;
106}
107
108bool Bu::StaticMemBuf::isBlocking()
109{
110 return true;
111}
112
113void Bu::StaticMemBuf::setBlocking( bool )
114{
115}
116
117void Bu::StaticMemBuf::setSize( size )
118{
119}
120
121Bu::size Bu::StaticMemBuf::getSize() const
122{
123 return iSize;
124}
125
126Bu::size Bu::StaticMemBuf::getBlockSize() const
127{
128 return iSize;
129}
130
131Bu::String Bu::StaticMemBuf::getLocation() const
132{
133 return "";
134}
135