68 lines
1.1 KiB
C++
68 lines
1.1 KiB
C++
#ifndef _GIF_ISTREAM_HPP_
|
||
#define _GIF_ISTREAM_HPP_
|
||
#ifndef _COMMON_WINDOWS_HPP_
|
||
#include <common/windows.hpp>
|
||
#endif
|
||
#include <io.h>
|
||
#include <fcntl.h>
|
||
#include <share.h>
|
||
#include <sys/stat.h>
|
||
|
||
class IStream
|
||
{
|
||
public:
|
||
#if defined(__FLAT__)
|
||
typedef void * VPTR;
|
||
#else
|
||
typedef void far * VPTR;
|
||
#endif
|
||
IStream(void);
|
||
IStream(const char *pathFileName);
|
||
virtual ~IStream();
|
||
BOOL open(const char *pathFileName);
|
||
void close(void);
|
||
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
|
||
|