![]() |
|
|||
File indexing completed on 2025-03-13 09:30:33
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_BINMEMINPUTSTREAM_HPP) 0023 #define XERCESC_INCLUDE_GUARD_BINMEMINPUTSTREAM_HPP 0024 0025 #include <xercesc/util/BinInputStream.hpp> 0026 #include <xercesc/util/PlatformUtils.hpp> 0027 0028 XERCES_CPP_NAMESPACE_BEGIN 0029 0030 class XMLUTIL_EXPORT BinMemInputStream : public BinInputStream 0031 { 0032 public : 0033 // ----------------------------------------------------------------------- 0034 // Class specific types 0035 // ----------------------------------------------------------------------- 0036 enum BufOpts 0037 { 0038 BufOpt_Adopt 0039 , BufOpt_Copy 0040 , BufOpt_Reference 0041 }; 0042 0043 0044 // ----------------------------------------------------------------------- 0045 // Constructors and Destructor 0046 // ----------------------------------------------------------------------- 0047 BinMemInputStream 0048 ( 0049 const XMLByte* const initData 0050 , const XMLSize_t capacity 0051 , const BufOpts bufOpt = BufOpt_Copy 0052 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0053 ); 0054 virtual ~BinMemInputStream(); 0055 0056 0057 // ----------------------------------------------------------------------- 0058 // Stream management methods 0059 // ----------------------------------------------------------------------- 0060 void reset(); 0061 0062 0063 // ----------------------------------------------------------------------- 0064 // Implementation of the input stream interface 0065 // ----------------------------------------------------------------------- 0066 virtual XMLFilePos curPos() const; 0067 0068 virtual XMLSize_t readBytes 0069 ( 0070 XMLByte* const toFill 0071 , const XMLSize_t maxToRead 0072 ); 0073 0074 virtual const XMLCh* getContentType() const; 0075 0076 inline XMLSize_t getSize() const; 0077 0078 private : 0079 // ----------------------------------------------------------------------- 0080 // Unimplemented constructors and operators 0081 // ----------------------------------------------------------------------- 0082 BinMemInputStream(const BinMemInputStream&); 0083 BinMemInputStream& operator=(const BinMemInputStream&); 0084 // ----------------------------------------------------------------------- 0085 // Private data members 0086 // 0087 // fBuffer 0088 // The buffer of bytes that we are streaming. 0089 // 0090 // fBufOpt 0091 // Indicates the ownership status of the buffer. The caller can have 0092 // us adopt it (we delete it), reference it, or just make our own 0093 // copy of it. 0094 // 0095 // fCapacity 0096 // The size of the buffer being streamed. 0097 // 0098 // fCurIndex 0099 // The current index where the next byte will be read from. When it 0100 // hits fCapacity, we are done. 0101 // ----------------------------------------------------------------------- 0102 const XMLByte* fBuffer; 0103 BufOpts fBufOpt; 0104 XMLSize_t fCapacity; 0105 XMLSize_t fCurIndex; 0106 MemoryManager* fMemoryManager; 0107 }; 0108 0109 0110 // --------------------------------------------------------------------------- 0111 // BinMemInputStream: Stream management methods 0112 // --------------------------------------------------------------------------- 0113 inline void BinMemInputStream::reset() 0114 { 0115 fCurIndex = 0; 0116 } 0117 0118 0119 // --------------------------------------------------------------------------- 0120 // BinMemInputStream: Implementation of the input stream interface 0121 // --------------------------------------------------------------------------- 0122 inline XMLFilePos BinMemInputStream::curPos() const 0123 { 0124 return fCurIndex; 0125 } 0126 0127 inline XMLSize_t BinMemInputStream::getSize() const 0128 { 0129 return fCapacity; 0130 } 0131 0132 XERCES_CPP_NAMESPACE_END 0133 0134 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |