home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RWWINSTREAM_H__
- #define __RWWINSTREAM_H__
- pragma push_align_members(64);
-
- /*
- * RWCLIPstreambuf & RWDDEstreambuf: Specialized streambufs, used for MS Windows (TM)
- *
- * $Header: E:/vcs/rw/winstrea.h_v 1.4 18 Feb 1992 09:54:52 KEFFER $
- *
- ****************************************************************************
- *
- * Rogue Wave
- * P.O. Box 2328
- * Corvallis, OR 97339
- * Voice: (503) 754-3010 FAX: (503) 757-6650
- *
- * Copyright (C) 1989, 1990, 1991. This software is subject to copyright
- * protection under the laws of the United States and other countries.
- *
- ***************************************************************************
- *
- * Under Windows, note the near similarity of the two constructors
- *
- * RWCLIPstreambuf(int N); // Dynamic. Initial allocation of "N"
- * RWCLIPstreambuf(HANDLE hMem); // Static. Use memory "hMem".
- *
- * This is because "HANDLE" has been typedef'd to "unsigned int", an
- * unfortunate consequence of Window's generally poor type checking.
- * Yet, the two constructors have vastly different semantics.
- *
- * It is for this reason that an extra dummy argument was added to
- * the first of these constructors:
- *
- * RWCLIPstreambuf(int N, int); // 2'nd argument ignored.
- *
- * This dummy argument is ignored.
- *
- * $Log: E:/vcs/rw/winstrea.h_v $
- *
- * Rev 1.4 18 Feb 1992 09:54:52 KEFFER
- *
- * Rev 1.3 12 Nov 1991 13:16:16 keffer
- * seek_dir is now scoped for C++ V2.1 compiliant compilers.
- *
- * Rev 1.2 05 Nov 1991 13:53:26 keffer
- * Can now live in the DLL.
- * Scoped seek_dir with ios::.
- *
- * Rev 1.1 28 Oct 1991 09:08:36 keffer
- * Changed inclusions to <rw/xxx.h>
- *
- * Rev 1.0 28 Jul 1991 08:18:12 keffer
- * Tools.h++ V4.0.5 PVCS baseline version
- *
- */
-
- #include "rw/defs.h"
- #include <windows.h>
- #ifdef __ZTC__
- # include <iostream.hpp>
- #else
- # ifdef __GLOCK__
- # include <iostream.hxx>
- # else
- # include <iostream.h>
- # endif
- #endif
-
- class RWExport RWCLIPstreambuf : public streambuf {
- protected:
- int frozen;
- int autoAlloc;
- int locked;
- HANDLE hMem;
- protected:
- // Virtual functions inherted from streambuf:
- virtual int doallocate();
- virtual int overflow(int);
- virtual streampos seekoff(streamoff, RWSCOPE(ios)seek_dir, int);
- virtual streambuf* setbuf(char* s, int n);
- virtual int underflow();
-
- // Virtual function introduced here:
- virtual HANDLE getHandle(DWORD size); // Type of handle can be overridden
-
- public:
- RWCLIPstreambuf(); // Dynamic mode
- RWCLIPstreambuf(int N, int); // Dynamic mode w. initial allocation N; see notes above
- RWCLIPstreambuf(HANDLE hMem); // Static mode, init w. block at hMem
- ~RWCLIPstreambuf(); // Free any unfrozen memory
-
- void freeze(int n = TRUE);
- HANDLE str(); // NB: return type
- };
-
- class RWExport RWDDEstreambuf : public RWCLIPstreambuf {
- WORD _wFormat;
- BOOL _fResponse;
- BOOL _fAckReq;
- BOOL _fRelease;
- protected:
- // Virtual functions overridden from RWCLIPstreambuf:
- virtual HANDLE getHandle(DWORD size);
- virtual int doallocate();
- public:
- /* This form usually used by server: */
- RWDDEstreambuf(WORD format, // Format of data
- BOOL response, // In response to WM_DDE_REQUEST; otherwise WM_DDE_ADVISE
- BOOL ackReq, // Requests an acknowledment
- BOOL release); // Client responsible for memory release
-
- RWDDEstreambuf(HANDLE hMem); /* Usually used by client */
-
- WORD format() const {return _wFormat;}
- BOOL response() const {return _fResponse;}
- BOOL ackReq() const {return _fAckReq;}
- BOOL release() const {return _fRelease;}
- };
-
- pragma pop_align_members();
- #endif
-