summaryrefslogtreecommitdiff
path: root/rhtvision/include/tv/ipstream.h
diff options
context:
space:
mode:
Diffstat (limited to 'rhtvision/include/tv/ipstream.h')
-rw-r--r--rhtvision/include/tv/ipstream.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/rhtvision/include/tv/ipstream.h b/rhtvision/include/tv/ipstream.h
new file mode 100644
index 0000000..d5a67f3
--- /dev/null
+++ b/rhtvision/include/tv/ipstream.h
@@ -0,0 +1,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
+