⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reader.h

📁 一个DB文件读取工具,最终转换CSV文件的代码.. 很有参考价值 作者:tanis
💻 H
字号:
// Reader.h: interface for the CReader class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_READER_H__391CFB5C_FA60_4BC5_B044_CC7BB81FFD78__INCLUDED_)
#define AFX_READER_H__391CFB5C_FA60_4BC5_B044_CC7BB81FFD78__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>

#include "DBF.h"

class TNotifyMsg
{
public:
	TNotifyMsg(CString tsState,float tfProgress){
		m_sState = tsState;
		m_fProgress = tfProgress;
	};
	const CString GetState(){
		return m_sState;
	};
	const float GetProgress(){
		return m_fProgress;
	};
	virtual ~ TNotifyMsg(){;};
private:
	CString m_sState;
	float   m_fProgress;
};
class CReader
{
public:
	CReader(CWnd * tpNotifyWnd,CString tsFileSource,CString tsFileSaved);
	virtual ~CReader();

	void DoWork();

public:
	static const int WM_WTNOTIFY;

protected:
	class CWorkThread : public CWinThread
	{
	public:
		CWorkThread(){
			m_fProgress = 0.0f;
			mDbf = new CDBF();
		};
		virtual ~ CWorkThread(){
			DestroyDatas();
		};
		void SetNotifyWnd(CWnd * tpWnd){
			m_pWndNotify = tpWnd;
		};
		void SetSourceFilePath(CString tsFilePath){
			m_sSourceFile = tsFilePath;
		};
		void SetSavedtFilePath(CString tsFilePath){
			m_sSavedFile = tsFilePath;
		};

		static SortByFirst(CRecord * tpA,CRecord * tpB){
			int iValue1,iValue2;
			unsigned int iLen1,ilen2;
			unsigned char buf1[MAXCHAR];
			unsigned char buf2[MAXCHAR];
			ZeroMemory(buf1,sizeof(buf1));
			ZeroMemory(buf2,sizeof(buf2));
			tpA->GetFirstField(buf1,&iLen1);
			tpB->GetFirstField(buf2,&ilen2);
			buf1[iLen1 + 1] = 0;
			buf2[ilen2 + 1] = 0;
			if (strcmp((char*)buf1,(char*)buf2) <= 0)
			{
				return TRUE;
			}
			else
			{
				return FALSE;
			}

		};
	protected:
		virtual BOOL InitInstance();
		virtual int  Run();
		BOOL DoSourceFile();
    	BOOL DoSavedFile();
    	void SendNotifyMsg();
		void SetState(CString tsState){
			m_sStateString = tsState;
		};
		void SetProgress(float tfProgress){
			m_fProgress = tfProgress;
		};
		void DestroyDatas();


	private:
    	CWnd * m_pWndNotify;
		CString m_sStateString;
		float  m_fProgress;
		CString m_sSourceFile;
		CString m_sSavedFile;
    	CDBF *mDbf;
		std::vector<CRecord * > m_vctRecord;
	} m_ctworker;

};

#endif // !defined(AFX_READER_H__391CFB5C_FA60_4BC5_B044_CC7BB81FFD78__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -