Initial
This commit is contained in:
64
mdiwin/ISTREAM.HPP
Normal file
64
mdiwin/ISTREAM.HPP
Normal file
@@ -0,0 +1,64 @@
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user