diff options
Diffstat (limited to '')
| -rw-r--r-- | src/stable/staticmembuf.cpp | 62 |
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 @@ | |||
| 10 | using namespace Bu; | 10 | using namespace Bu; |
| 11 | 11 | ||
| 12 | Bu::StaticMemBuf::StaticMemBuf( const void *pData, size iSize ) : | 12 | Bu::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 | ||
| 27 | size Bu::StaticMemBuf::read( void *pBuf, size nBytes ) | 27 | size 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 | ||
| 38 | size Bu::StaticMemBuf::write( const void *, size ) | 38 | size Bu::StaticMemBuf::write( const void *, size ) |
| 39 | { | 39 | { |
| 40 | return -1; | 40 | return -1; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | size Bu::StaticMemBuf::tell() | 43 | size Bu::StaticMemBuf::tell() |
| 44 | { | 44 | { |
| 45 | return nPos; | 45 | return nPos; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | void Bu::StaticMemBuf::seek( size offset ) | 48 | void 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 | ||
| 55 | void Bu::StaticMemBuf::setPos( size pos ) | 55 | void 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 | ||
| 62 | void Bu::StaticMemBuf::setPosEnd( size pos ) | 62 | void 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 | ||
| 69 | bool Bu::StaticMemBuf::isEos() | 69 | bool Bu::StaticMemBuf::isEos() |
| 70 | { | 70 | { |
| 71 | return (nPos == iSize); | 71 | return (nPos == iSize); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | bool Bu::StaticMemBuf::isOpen() | 74 | bool Bu::StaticMemBuf::isOpen() |
| 75 | { | 75 | { |
| 76 | return true; | 76 | return true; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void Bu::StaticMemBuf::flush() | 79 | void Bu::StaticMemBuf::flush() |
| @@ -82,32 +82,32 @@ void Bu::StaticMemBuf::flush() | |||
| 82 | 82 | ||
| 83 | bool Bu::StaticMemBuf::canRead() | 83 | bool Bu::StaticMemBuf::canRead() |
| 84 | { | 84 | { |
| 85 | return !isEos(); | 85 | return !isEos(); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | bool Bu::StaticMemBuf::canWrite() | 88 | bool Bu::StaticMemBuf::canWrite() |
| 89 | { | 89 | { |
| 90 | return false; | 90 | return false; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | bool Bu::StaticMemBuf::isReadable() | 93 | bool Bu::StaticMemBuf::isReadable() |
| 94 | { | 94 | { |
| 95 | return true; | 95 | return true; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | bool Bu::StaticMemBuf::isWritable() | 98 | bool Bu::StaticMemBuf::isWritable() |
| 99 | { | 99 | { |
| 100 | return false; | 100 | return false; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | bool Bu::StaticMemBuf::isSeekable() | 103 | bool Bu::StaticMemBuf::isSeekable() |
| 104 | { | 104 | { |
| 105 | return true; | 105 | return true; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | bool Bu::StaticMemBuf::isBlocking() | 108 | bool Bu::StaticMemBuf::isBlocking() |
| 109 | { | 109 | { |
| 110 | return true; | 110 | return true; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | void Bu::StaticMemBuf::setBlocking( bool ) | 113 | void Bu::StaticMemBuf::setBlocking( bool ) |
| @@ -120,16 +120,16 @@ void Bu::StaticMemBuf::setSize( size ) | |||
| 120 | 120 | ||
| 121 | Bu::size Bu::StaticMemBuf::getSize() const | 121 | Bu::size Bu::StaticMemBuf::getSize() const |
| 122 | { | 122 | { |
| 123 | return iSize; | 123 | return iSize; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | Bu::size Bu::StaticMemBuf::getBlockSize() const | 126 | Bu::size Bu::StaticMemBuf::getBlockSize() const |
| 127 | { | 127 | { |
| 128 | return iSize; | 128 | return iSize; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | Bu::String Bu::StaticMemBuf::getLocation() const | 131 | Bu::String Bu::StaticMemBuf::getLocation() const |
| 132 | { | 132 | { |
| 133 | return ""; | 133 | return ""; |
| 134 | } | 134 | } |
| 135 | 135 | ||
