Files
Work/gif/ISTREAM.HPP
2024-08-07 09:16:27 -04:00

68 lines
1.1 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 _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