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

📄 sadirread.h

📁 一个windows ce上的notepad
💻 H
字号:
/*********************************************************************

   SADirRead

   Copyright (C) 2002 Smaller Animals Software, Inc.

   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   arising from the use of this software.

   Permission is granted to anyone to use this software for any purpose,
   including commercial applications, and to alter it and redistribute it
   freely, subject to the following restrictions:

   1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.

   2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.

   3. This notice may not be removed or altered from any source distribution.

   http://www.smalleranimals.com
   smallest@smalleranimals.com

**********************************************************************/

// SADirRead.h: interface for the CSADirRead class.
//
//////////////////////////////////////////////////////////////////////

#define USE_WIN32_FINDFILE

#if !defined(AFX_SADIRREAD_H__5BC7B291_F166_11D4_9393_0050DABB534C__INCLUDED_)
#define AFX_SADIRREAD_H__5BC7B291_F166_11D4_9393_0050DABB534C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
using namespace std;
#pragma warning(disable:4786)

//////////////////////////////////////////////////////////////////////

class CSADirRead  
{
public:
	CSADirRead();
	virtual ~CSADirRead();

   /* 
      GetDirs

      first, build the list of folders we will scan. we do this as a separate step
      to allow the class to scan multiple folders when GetFiles is called.

      if bRecurse is true, this adds the input folder and all subfolders to 
      the list of folders to scan. if Recurse is False, it adds pDirPath to the 
      list of folders to scan.
   */
	bool	GetDirs(const TCHAR * pDirPath, bool bRecurse);


   /* 
      GetFiles

      if bIncludeFoldersInFileList is true, folder names will be 
      included along with file names.

      if bIncludeFilesInFileList is false, and set bIncludeFoldersInFileList to 
      true, if you only want to get a list of sub-folders.

      then get the files in the folders you've specified above. all folders specified
      in your GetDirs calls are scanned. 
   */
	bool	GetFiles(const TCHAR *pFilemask, bool bIncludeFilesInFileList = true, bool bIncludeFoldersInFileList = false);

   // remove all entries
	bool	ClearDirs();
	bool	ClearFiles();

	// if you want to sort the data
	enum {eSortNone, eSortAlpha, eSortWriteDate, eSortSize};
	bool	SortFiles(int iSortStyle, bool bReverse);

	//////////////////////////////////////////////////////////////////////

	// directories
	struct CSADirEntry
	{
		CSADirEntry()	{}
		CSADirEntry(const CString &s)
		{
			m_sName = s;
		}
		CString m_sName;
	};

	typedef vector<CSADirEntry> SADirVector;

	SADirVector &Dirs()	{return m_dirs;}

	//////////////////////////////////////////////////////////////////////

	// files
#ifdef USE_WIN32_FINDFILE
	struct CSAFileEntry
	{
		CString	m_sName;
      bool     bIsFolder;
		unsigned int attrib;
		unsigned __int64 time_create;
		unsigned __int64 time_access;
		unsigned __int64 time_write;
		unsigned __int64 size;
	};
#else
	struct CSAFileEntry
	{
		CString	m_sName;
      bool     bIsFolder;
		unsigned int attrib;
		time_t time_create;
		time_t time_access;
		time_t time_write;
		_fsize_t size;

	};
#endif

	typedef vector<CSAFileEntry> SAFileVector;

	SAFileVector &Files()	{return m_files;}

	//////////////////////////////////////////////////////////////////////

protected:

	bool	GetSubDirs(SADirVector &dir_array, const CString &path);
	UINT	FindFiles(const CString & dir, const CString & filter, bool bIncludeFilesInFileList, bool bIncludeFoldersInFileList);
	void	FormatPath(CString &path);

	CString	m_sSourceDir;

	SADirVector m_dirs;
	SAFileVector m_files;
};

#endif // !defined(AFX_SADIRREAD_H__5BC7B291_F166_11D4_9393_0050DABB534C__INCLUDED_)

⌨️ 快捷键说明

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