1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef CSV_MBSTREAM_HXX 25 #define CSV_MBSTREAM_HXX 26 27 // USED SERVICES 28 // BASE CLASSES 29 #include <cosv/bstream.hxx> 30 // COMPONENTS 31 // PARAMETERS 32 33 34 namespace csv 35 { 36 37 class mbstream : public bstream 38 { 39 public: 40 // LIFECYCLE 41 mbstream( 42 uintt i_nSize); 43 ~mbstream(); 44 // OPERATIONS 45 void resize( 46 uintt i_nSize ); 47 // INQUIRY 48 uintt size() const; 49 const void * data() const; 50 51 private: 52 // Interface bistream: 53 virtual uintt do_read( 54 void * out_pDest, 55 uintt i_nNrofBytes); 56 virtual bool inq_eod() const; 57 // Interface bostream: 58 virtual uintt do_write( 59 const void * i_pSrc, 60 uintt i_nNrofBytes); 61 // Interface bstream: 62 virtual uintt do_seek( 63 intt i_nDistance, 64 seek_dir i_eStartPoint = ::csv::beg ); 65 virtual uintt inq_position() const; 66 67 // DYN 68 DYN char * dpOwnedMemorySpace; 69 uintt nSize; 70 uintt nCurPosition; 71 }; 72 73 74 // IMPLEMENTATION 75 76 inline uintt size() const77mbstream::size() const 78 { return nSize; } 79 inline const void * data() const80mbstream::data() const 81 { return dpOwnedMemorySpace; } 82 83 84 } // namespace csv 85 86 87 #endif 88 89 90