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

📄 ftplistparse.h

📁 自己改写的在WINCE上开发用的EVC++的FTP操作示例工程,希望能给相关人士提供帮助.
💻 H
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Code taken from D. J. Bernstein (C ==> C++)
//
// ftpparse.c, ftpparse.h: library for parsing FTP LIST responses
// 20001223
// D. J. Bernstein, djb@cr.yp.to
// http://cr.yp.to/ftpparse.html
//
// Commercial use is fine, if you let me know what programs you're using this in.
//
// Currently covered formats:
// EPLF.
// UNIX ls, with or without gid.
// Microsoft FTP Service.
// Windows NT FTP Server.
// VMS.
// WFTPD.
// NetPresenz (Mac).
// NetWare.
// MSDOS.
//
// Definitely not covered: 
// Long VMS filenames, with information split across two lines.
// NCSA Telnet FTP server. Has LIST = NLST (and bad NLST for directories).
//
////////////////////////////////////////////////////////////////////////////////

#ifndef INC_FTPLISTPARSE_H
#define INC_FTPLISTPARSE_H

//#include <string>
#include "Definements.h"
#include "StringA.h"

namespace nsFTP
{
	class CFTPFileStatus;
	
	/// Implements the parsing of the string returned by the LIST command.
	class CFTPListParse
	{
	public:
		CFTPListParse();
		~CFTPListParse();
		
	public:
		bool Parse(CFTPFileStatus& ftpFileStatus, CStringA& strLineToParse);
		
		bool IsEPLS(LPCSTR pszLine);
		bool ParseEPLF(CFTPFileStatus& ftpFileStatus, LPCSTR pszLine, int iLength);
		
		bool IsUNIXStyleListing(LPCSTR pszLine);
		bool ParseUNIXStyleListing(CFTPFileStatus& ftpFileStatus, LPCSTR pszLine, int iLength);
		
		bool IsMultiNetListing(LPCSTR pszLine);
		bool ParseMultiNetListing(CFTPFileStatus& ftpFileStatus, LPCSTR pszLine, int iLength);
		
		bool IsMSDOSListing(LPCSTR pszLine);
		bool ParseMSDOSListing(CFTPFileStatus& ftpFileStatus, LPCSTR pszLine, int iLength);
		
	private:
		bool CheckMonth(LPCSTR pszBuffer, LPCSTR pszMonthName) const;
		int  GetMonth(LPCSTR pszBuffer, int iLength) const;
		bool GetLong(LPCSTR pszLong, int iLength, long& lResult) const;
		long GetYear(time_t time) const;
		
		long ToTAI(long lYear, long lMonth, long lMDay) const;
		long GuessTAI(long lMonth, long lMDay);
		
	private:
		time_t        m_tmBase;       // time() value on this OS at the beginning of 1970 TAI
		long          m_lCurrentYear; // approximation to current year
		static CHAR*  m_Months[12];
	};
}

#endif // INC_FTPLISTPARSE_H

⌨️ 快捷键说明

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