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

📄 ftphelp.h

📁 自己改写的在WINCE上开发用的EVC++的FTP操作示例工程,希望能给相关人士提供帮助.
💻 H
字号:
#ifndef INC_FTPHELP_H
#define INC_FTPHELP_H

#include "FTPDataTypes.h"
#include "DataStack2.h"
#include <algorithm>

namespace nsFTP
{
	//typedef std::vector<tstring> TStringVector;
	typedef std::vector<CStringA> TStringVector;
	
	class ITransferNotification
	{
	public:
		virtual void OnBytesReceived(CDataStack2& /*vBuffer*/, long /*lReceivedBytes*/) {}
		virtual void OnPreBytesSend(CDataStack2& /*vBuffer*/, size_t& /*bytesToSend*/) {}
	};
	
	class CMakeString
	{
	public:
		CMakeString& operator<<(DWORD dwNum);
		CMakeString& operator<<(const CStringA& strAdd);
		CMakeString& operator<<(const LPSTR strAdd);
		CStringA GetString() const { return m_str; }
		
	private:
		CStringA m_str;
	};
	
	class CFileT : public ITransferNotification
	{
		FILE* m_pFile;
	public:
		enum T_enOrigin { orBegin=SEEK_SET, orEnd=SEEK_END, orCurrent=SEEK_CUR };
		
		CFileT();
		~CFileT();
		
		bool Open(CStringA strFileName, CStringA strMode);
		bool Close();
		bool Seek(long lOffset, T_enOrigin enOrigin);
		long Tell();
		size_t Write(const void* pBuffer, size_t itemSize, size_t itemCount);
		size_t Read(void* pBuffer, size_t itemSize, size_t itemCount);
		virtual void OnBytesReceived(CDataStack2& vBuffer, long lReceivedBytes);
		virtual void OnPreBytesSend(CDataStack2& vBuffer, size_t& bytesToSend);
	};
	
	class COutputStream : public ITransferNotification
	{
		const CStringA mc_strEolCharacterSequence;
		CDataStack2 m_vBuffer;
		int m_itCurrentPos;
		
	public:
		COutputStream(const CStringA& strEolCharacterSequence);
		void SetStartPosition();
		bool GetNextLine(CStringA& strLine);// const
		virtual void OnBytesReceived(CDataStack2& vBuffer, long lReceivedBytes);
	};
	
	class CNotification
	{
	public:
		virtual void OnInternalError(CStringA /*strErrorMsg*/, CStringA /*strFileName*/, DWORD /*dwLineNr*/) {}
		
		virtual void OnBeginReceivingData() {}
		virtual void OnEndReceivingData(long /*lReceivedBytes*/) {}
		virtual void OnBytesReceived(CDataStack2& /*vBuffer*/, long /*lReceivedBytes*/) {}
		virtual void OnBytesSent(CDataStack2& /*vBuffer*/, long /*lSentBytes*/) {}
		
		virtual void OnPreReceiveFile(CStringA /*strSourceFile*/, CStringA /*strTargetFile*/, long /*lFileSize*/) {}
		virtual void OnPreSendFile(CStringA /*strSourceFile*/, CStringA /*strTargetFile*/, long /*lFileSize*/) {}
		virtual void OnPostReceiveFile(CStringA /*strSourceFile*/, CStringA /*strTargetFile*/, long /*lFileSize*/) {}
		virtual void OnPostSendFile(CStringA /*strSourceFile*/, CStringA /*strTargetFile*/, long /*lFileSize*/) {}
		
		virtual void OnSendCommand(CStringA /*strCommand*/) {}
		virtual void OnResponse(CReply& /*Reply*/) {}
	};
}

#endif // INC_FTPHELP_H

⌨️ 快捷键说明

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