home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 6.ddi / MWHC.006 / S1 < prev    next >
Encoding:
Text File  |  1992-06-07  |  4.9 KB  |  160 lines

  1. #ifndef __RWPSTREAM_H__
  2. #define __RWPSTREAM_H__
  3. pragma push_align_members(64);
  4.  
  5. /*
  6.  * rwp[io]stream ---    Portable I/O streams (use escape sequences for 
  7.  *             writing special characters.
  8.  *
  9.  * $Header:   E:/vcs/rw/pstream.h_v   1.8   17 Mar 1992 12:26:48   KEFFER  $
  10.  *
  11.  ****************************************************************************
  12.  *
  13.  * Rogue Wave Software, Inc.
  14.  * P.O. Box 2328
  15.  * Corvallis, OR 97339
  16.  * Voice: (503) 754-3010    FAX: (503) 757-6650
  17.  *
  18.  * Copyright (C) 1989, 1990, 1991. This software is subject to copyright 
  19.  * protection under the laws of the United States and other countries.
  20.  *
  21.  ***************************************************************************
  22.  *
  23.  * $Log:   E:/vcs/rw/pstream.h_v  $
  24.  * 
  25.  *    Rev 1.8   17 Mar 1992 12:26:48   KEFFER
  26.  * Removed RWTV3_COMPATIBLE macro hooks.
  27.  * 
  28.  *    Rev 1.7   18 Feb 1992 09:54:32   KEFFER
  29.  * 
  30.  *    Rev 1.6   13 Nov 1991 11:09:16   keffer
  31.  * Removed "near" qualifiers.  Both putwrap()'s are now out of line.
  32.  * 
  33.  *    Rev 1.5   05 Nov 1991 13:52:50   keffer
  34.  * Can now live in the DLL
  35.  * 
  36.  *    Rev 1.4   17 Oct 1991 09:12:46   keffer
  37.  * Changed include path to <rw/xxx.h>
  38.  * 
  39.  *    Rev 1.2   29 Jul 1991 11:33:32   keffer
  40.  * Macro CHAR_MATCHES_UCHAR checks for overloaded unsigned char
  41.  * 
  42.  */
  43.  
  44. #include "rw/vstream.h"
  45.  
  46. /************************************************
  47.  *                        *
  48.  *        class RWpistream        *
  49.  *                        *
  50.  ************************************************/
  51.  
  52. class RWExport RWpistream : 
  53.  
  54. #ifdef HAS_IOSTREAMS
  55.             public istream, public RWvistream {
  56. #else
  57.             public RWvistream {
  58. #endif
  59.  
  60. public:
  61.   RWpistream(istream& str);
  62.   RWpistream(streambuf* s);
  63.  
  64.   virtual int        get();
  65.   virtual RWvistream&    get(char&);
  66. #ifndef CHAR_MATCHES_UCHAR
  67.   virtual RWvistream&    get(unsigned char&);
  68. #endif
  69.   virtual RWvistream&    get(char*, unsigned N);
  70.   virtual RWvistream&    get(double*, unsigned N);
  71.   virtual RWvistream&    get(float*, unsigned N);
  72.   virtual RWvistream&    get(int*, unsigned N);
  73.   virtual RWvistream&    get(long*, unsigned N);
  74.   virtual RWvistream&    get(short*, unsigned N);
  75. #ifndef CHAR_MATCHES_UCHAR
  76.   virtual RWvistream&    get(unsigned char*, unsigned N);
  77. #endif
  78.   virtual RWvistream&    get(unsigned short*, unsigned N);
  79.   virtual RWvistream&    get(unsigned int*, unsigned N);
  80.   virtual RWvistream&    get(unsigned long*, unsigned N);
  81.   virtual RWvistream&    getString(char* s, unsigned maxlen);
  82.   virtual RWvistream&    operator>>(char&);
  83.   virtual RWvistream&    operator>>(double&);
  84.   virtual RWvistream&    operator>>(float&);
  85.   virtual RWvistream&    operator>>(int&);
  86.   virtual RWvistream&    operator>>(long&);
  87.   virtual RWvistream&    operator>>(short&);
  88. #ifndef CHAR_MATCHES_UCHAR
  89.   virtual RWvistream&    operator>>(unsigned char&);
  90. #endif
  91.   virtual RWvistream&    operator>>(unsigned int&);
  92.   virtual RWvistream&    operator>>(unsigned long&);
  93.   virtual RWvistream&    operator>>(unsigned short&);
  94. protected:
  95.   void            checkRead();
  96.   void            overflowErr(unsigned, const char*);
  97.   void            syntaxErr(const char* expect, char was);
  98.   char            getCChar();
  99. };
  100.  
  101. /************************************************
  102.  *                        *
  103.  *        class RWpostream        *
  104.  *                        *
  105.  ************************************************/
  106.  
  107. class RWExport RWpostream : 
  108.  
  109. #ifdef HAS_IOSTREAMS
  110.             public ostream , public RWvostream {
  111. #else
  112.             public RWvostream {
  113. #endif
  114.  
  115. public:
  116.   RWpostream(ostream& str);
  117.   RWpostream(streambuf* s);
  118.  
  119.   virtual RWvostream&    operator<<(const char*);
  120.   virtual RWvostream&    operator<<(char);
  121. #ifndef CHAR_MATCHES_UCHAR
  122.   virtual RWvostream&    operator<<(unsigned char);
  123. #endif
  124.   virtual RWvostream&    operator<<(double);
  125.   virtual RWvostream&    operator<<(float);
  126.   virtual RWvostream&    operator<<(int);
  127.   virtual RWvostream&    operator<<(unsigned int);
  128.   virtual RWvostream&    operator<<(long);
  129.   virtual RWvostream&    operator<<(unsigned long);
  130.   virtual RWvostream&    operator<<(short);
  131.   virtual RWvostream&    operator<<(unsigned short);
  132.  
  133.   virtual RWvostream&    put(char);
  134.   virtual RWvostream&    put(const char* p, unsigned N);
  135. #ifndef CHAR_MATCHES_UCHAR
  136.   virtual RWvostream&    put(unsigned char);
  137.   virtual RWvostream&    put(const unsigned char* p, unsigned N);
  138. #endif
  139.   virtual RWvostream&    put(const short* p, unsigned N);
  140.   virtual RWvostream&    put(const unsigned short* p, unsigned N);
  141.   virtual RWvostream&    put(const int* p, unsigned N);
  142.   virtual RWvostream&    put(const unsigned int* p, unsigned N);
  143.   virtual RWvostream&    put(const long* p, unsigned N);
  144.   virtual RWvostream&    put(const unsigned long* p, unsigned N);
  145.   virtual RWvostream&    put(const float* p, unsigned N);
  146.   virtual RWvostream&    put(const double* p, unsigned N);
  147. protected:
  148.   unsigned        column;
  149.   static const unsigned    MAXCOL;
  150.   void            putwrap(char);
  151. #ifndef CHAR_MATCHES_UCHAR
  152.   void            putwrap(unsigned char c);
  153. #endif
  154.   void            putwrap(const char* s, unsigned len);
  155.   void            putCChars(const char* s);
  156. };
  157.  
  158. pragma pop_align_members();
  159. #endif /* __RWPSTREAM_H__ */
  160.