📄 webdatafile.h
字号:
// WebDataFile.h: interface for the CWebDataFile class.
//
//////////////////////////////////////////////////////////////////////
#ifndef _WEBDATAFILE_H_050404_
#define _WEBDATAFILE_H_050404_
#include <stdio.h>
#include <string>
using namespace std;
class CWebDataFile
{
protected:
bool m_bRawFormat;
bool m_bPageError;
bool m_bFileOpen;
char * m_sFileName;
FILE * m_fRaw;
int m_nReadFileLen;
char * m_sDataBuffer;
int m_nBufferLen;
char * m_sUnzipBuffer;
int m_nDataLen;
int m_nProcessedLen;
bool m_bEOF;
bool GetARawWebPage(string sFileName);
public:
// The default buffer length to allocate: 32MB
// You can change it first.
// It assert that a Web page is less than the length.
// It can be configured lager for good performance.
static int m_nDefaultBufferLen;
protected:
void ReadFromFile();
public:
CWebDataFile();
virtual ~CWebDataFile();
// This function must be called before any other functions.
// It's to allocate the data buffer, return FALSE in the
// case of insufficient memory.
bool InitDataBuffer(unsigned int nLen = m_nDefaultBufferLen);
// Close the Web data file.
void CloseFile();
// Open a Web data file.
bool OpenFile(const char * sFileName);
// Get a Web page for further processing.
// return NULL if failed (end of file).
bool GetAWebPage(string sFileName);
// Get the processed file len.
int GetProcessedFileLen();
// Seek to processed length.
void SeekToLength(int nLen);
bool IsRawFormat(){
return m_bRawFormat;
}
bool IsPageError(){
return m_bPageError;
}
};
#endif // _WEBDATAFILE_H_050404_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -