Files
Work/mdiwin/STREAM.HPP
2024-08-07 09:16:27 -04:00

64 lines
1.0 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef _ISTREAM_HPP_
#define _ISTREAM_HPP_
#include <io.h>
#include <fcntl.h>
#include <share.h>
#include <sys/stat.h>
#include <mdiwin/windows.hpp>
#include <mdiwin/types.hpp>
class IStream
{
public:
#if defined(__FLAT__)
typedef void * VPTR;
#else
typedef void far * VPTR;
#endif
IStream(const char *pathFileName);
virtual ~IStream();
WORD isOpen(void)const;
WORD getChar(void);
WORD getWord(void);
UCHAR currentChar(void)const;
USHORT currentWord(void)const;
void closeFile(void);
private:
enum{MaxInputBuffer=6400};
HGLOBAL mhGlobalBuffer;
UCHAR FAR *mlpBuffer;
UCHAR FAR *mlpBufferPointer;
USHORT mBufferIndex;
short mFileDescriptor;
USHORT mCurrentWord;
UCHAR mCurrentChar;
};
inline
UCHAR IStream::currentChar(void)const
{
return mCurrentChar;
}
inline
USHORT IStream::currentWord(void)const
{
return mCurrentWord;
}
inline
void IStream::closeFile(void)
{
if(-1!=mFileDescriptor)::close(mFileDescriptor);
mFileDescriptor=-1;
}
inline
WORD IStream::isOpen(void)const
{
if(-1==mFileDescriptor)return FALSE;
return TRUE;
}
#endif