1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*
* Turbo Vision - Version 2.0
*
* Copyright (c) 1994 by Borland International
* All Rights Reserved.
*
* Modified by Robert H”hne to be used for RHIDE.
*
* Modified by Jose Angel Sanchez Caso (JASC) to have machine endian and
* integer size compatibility.
*
* Added functions to rework the endian stuff by SET: readShort, readInt,
* readLong, read8, read16, read32 and read64.
*
* Modified to compile with gcc v3.x by Salvador E. Tropea (SET), with
* the help of Andris Pavenis and Christoph Bauer.
*
* ------------------------------------------------------------------------*
* *
* class ipstream *
* *
* Base class for reading streamable objects *
* *
* ------------------------------------------------------------------------*/
#if defined( Uses_ipstream ) && !defined( __ipstream )
#define __ipstream
class TStreamableClass;
class TPReadObjects;
class CLY_EXPORT ipstream : virtual public pstream
{
public:
ipstream(CLY_streambuf *);
~ipstream();
CLY_StreamPosT tellg();
ipstream& seekg( CLY_StreamPosT );
ipstream& seekg( CLY_StreamOffT, CLY_IOSSeekDir );
uchar readByte();
ushort readWord() { return readShort(); };
void readBytes( void *, size_t );
char * readString();
char * readString( char *, unsigned );
/* Platform dependent: */
ushort readShort();
uint readInt();
ulong readLong();
/* The following are platform independent (stores in little endian) */
uint8 read8() { return readByte(); };
uint16 read16();
uint32 read32();
uint64 read64();
#ifndef TVComp_BCPP
ipstream& operator >> (signed char &ch ) {ch=readByte(); return (*this);}
#endif
ipstream& operator >> (char &ch ) {ch=readByte(); return (*this);}
ipstream& operator >> (unsigned char &ch ) {ch=readByte(); return (*this);}
ipstream& operator >> (signed short &sh ) {sh=readShort(); return (*this);}
ipstream& operator >> (unsigned short &sh ) {sh=readShort(); return (*this);}
ipstream& operator >> (signed int &i ) { i=readInt(); return (*this);}
ipstream& operator >> (unsigned int &i ) { i=readInt(); return (*this);}
ipstream& operator >> (signed long &l ) { l=readLong(); return (*this);}
ipstream& operator >> (unsigned long &l ) { l=readLong(); return (*this);}
ipstream& operator >> (float &f ) { readBytes( &f, sizeof(f) ); return (*this);}
ipstream& operator >> (double &d ) { readBytes( &d, sizeof(d) ); return (*this);}
friend ipstream& operator >> ( ipstream&, TStreamable& );
friend ipstream& operator >> ( ipstream&, void *& );
protected:
ipstream();
const TStreamableClass * readPrefix();
void * readData( const TStreamableClass *,
TStreamable * );
void readSuffix();
const void * find( P_id_type );
void registerObject( const void *adr );
private:
TPReadObjects *objs;
};
#endif // Uses_ipstream
|