Quelltext /~heha/hs/borg.zip/SAVEFILE.H

//	 savefile.h
//

#ifndef savefile_h
#define savefile_h

#include "list.h"
#include "common.h"

#define RBUFF_MAXLEN 4096
#define rle_code 0x0f

class savefile {
private:
 HANDLE sfile;
 unsigned long rbufflen;
 unsigned long rbuffptr;
 byte rbuff[RBUFF_MAXLEN+1];
 bool rbhigh;
 bool rlemode;
 bool rlestart;
 byte rlecount;
 byte rlebyte;
 bool compressed;	// whether data is RLE compressed or not
public:
 bool okay;		// if any Read/Write fail, consecutive fails are silently

private:
 bool getnibble(byte *n);
 bool getrlenibble(byte *n);
 bool putnibble(byte n);
 bool flushnibble(void);
 bool putrlenibble(byte n);
 bool flushrlenibble(void);

public:
 savefile();
 ~savefile();
 bool sopen(LPCTSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,
   DWORD dwCreationDistribution,DWORD dwFlagsAndAttributes,bool compr);
 void sclose(void);
 bool flushfilewrite(void);
 bool Read(LPVOID lpBuffer,DWORD nNumberOfBytesToRead);		// GUI version
 bool Write(LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite);	// GUI version
private:
 bool sread(LPVOID lpBuffer,DWORD nNumberOfBytesToRead);
 bool swrite(LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite);
};

#endif
Vorgefundene Kodierung: ASCII (7 bit)2