You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.4 KiB

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