2 Copyright (c) 2001, Loki software, inc.
3 modifications (c) 2001, Id software, inc.
6 Redistribution and use in source and binary forms, with or without modification,
7 are permitted provided that the following conditions are met:
9 Redistributions of source code must retain the above copyright notice, this list
10 of conditions and the following disclaimer.
12 Redistributions in binary form must reproduce the above copyright notice, this
13 list of conditions and the following disclaimer in the documentation and/or
14 other materials provided with the distribution.
16 Neither the name of Loki software nor the names of its contributors may be used
17 to endorse or promote products derived from this software without specific prior
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
24 DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 Based on an initial implementation by Loki software
39 modified to be abstracted and shared across modules
41 NOTE: why IDataStream and not IStream? because IStream is defined in windows IDL headers
48 virtual ~IDataStream();
50 virtual void IncRef () = 0; ///< Increment the number of references to this object
51 virtual void DecRef () = 0; ///< Decrement the reference count
53 virtual unsigned long GetPosition() const = 0;
54 virtual unsigned long Seek(long lOff, int nFrom) = 0;
55 virtual void SetLength(unsigned long nNewLen) = 0;
56 virtual unsigned long GetLength() const = 0;
58 virtual char* ReadString(char* pBuf, unsigned long nMax)=0;
59 virtual unsigned long Read(void* pBuf, unsigned long nCount)=0;
60 virtual unsigned long Write(const void* pBuf, unsigned long nCount)=0;
61 virtual int GetChar()=0;
62 virtual int PutChar(int c)=0;
64 virtual void printf(const char*, ...) = 0; ///< completely matches the usual printf behaviour
66 virtual void Abort()=0;
67 virtual void Flush()=0;
68 virtual void Close()=0;