00001 /* 00002 00003 Copyright (c) 2002-2005, Yauheni Akhotnikau 00004 All rights reserved. 00005 00006 Redistribution and use in source and binary forms, with or without 00007 modification, are permitted provided that the following conditions are met: 00008 00009 - Redistributions of source code must retain the above copyright notice, this 00010 list of conditions and the following disclaimer. 00011 00012 - Redistributions in binary form must reproduce the above copyright notice, this 00013 list of conditions and the following disclaimer in the documentation and/or 00014 other materials provided with the distribution. 00015 00016 - The name of the author may not be used to endorse or promote products derived 00017 from this software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 00022 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00024 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00027 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00028 OF SUCH DAMAGE. 00029 00030 */ 00031 00037 #if !defined( _OESS_1__IO__SUBBINSTREAM_HPP_ ) 00038 #define _OESS_1__IO__SUBBINSTREAM_HPP_ 00039 00040 #include <oess_1/io/h/declspec.hpp> 00041 00042 #include <oess_1/io/h/binbuffer.hpp> 00043 00044 namespace oess_1 { 00045 00046 namespace io { 00047 00048 // 00049 // isubbinstream_t 00050 // 00051 00053 00082 class OESS_1__IO__TYPE isubbinstream_t : 00083 public ibinbuffer_t 00084 { 00085 public : 00086 isubbinstream_t( 00088 ibinstream_t & source, 00090 size_t capacity ); 00091 virtual ~isubbinstream_t(); 00092 00094 00097 size_t 00098 capacity() const; 00099 00101 00104 virtual size_t 00105 size() const; 00106 00108 virtual size_t 00109 pos() const; 00110 00112 virtual bool 00113 eof() const; 00114 00115 protected : 00117 00122 virtual const oess_1::char_t * 00123 in_reserve( 00126 size_t item_count, 00128 size_t item_size, 00131 size_t & item_available ); 00132 00134 virtual void 00135 in_shift( 00137 size_t item_count, 00139 size_t item_size ); 00140 00141 private : 00143 ibinstream_t & m_source; 00145 00148 size_t m_capacity; 00150 size_t m_pos; 00151 00152 private : 00154 isubbinstream_t( 00155 const isubbinstream_t & ); 00157 isubbinstream_t & 00158 operator=( 00159 const isubbinstream_t & ); 00160 }; 00161 00162 } /* namespace io */ 00163 00164 } /* namespace oess_1 */ 00165 00166 #endif 00167