📄 vmdirscanner.h
字号:
#ifndef VM_DIR_SCANNER_H_INCLUDED
#define VM_DIR_SCANNER_H_INCLUDED
/*****************************************************************************/
/* HEADER FILE */
/*****************************************************************************/
/*
$Archive: $
$Revision: $
$Date: $
$Author: $
Description: Declaration of the Directory Scanner Class
TOOL And XML FORMS License
==========================
Except where otherwise noted, all of the documentation
and software included in the TOOL package is
copyrighted by Michael Swartzendruber.
Copyright (C) 2005 Michael John Swartzendruber.
All rights reserved.
Access to this code, whether intentional or accidental,
does NOT IMPLY any transfer of rights.
This software is provided "as-is," without any express
or implied warranty. In no event shall the author 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 and redistribute it, provided that the following
conditions are met:
1. All redistributions of source code files must retain
all copyright notices that are currently in place,
and this list of conditions without modification.
2. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
3. If you use this software in another product, an acknowledgment
in the product documentation would be appreciated but is
not required.
4. Modified versions in source or binary form must be plainly
marked as such, and must not be misrepresented as being
the original software.
*/
/*****************************************************************************/
#include <vector>
#include <string>
#include "VMLastSystemErrorCode.h"
#include "VMString.h"
typedef std::vector< std::string > VM_FILE_FIND_LIST;
typedef VM_FILE_FIND_LIST::iterator VM_FILE_FIND_ITER;
class VMDirScanner : public VMSysLastError
{
public:
VMDirScanner( const char* pchRoot, const char* pchMask, bool bRecurse );
~VMDirScanner( void );
// iterator functions
//
VMString GetFirstFile( void );
VMString GetNextFile( void );
VMString GetLastDirectory( void );
VMString GetPrevDirectory( void );
bool FindFile( const char* pchFileToFind );
protected:
bool ScanForAllFiles( WORD wLevel );
bool CurDirFileScan( void );
private:
void GoUpOneDir( char* pchDir );
void AddBackSlash( char* pchWorking );
private:
VM_FILE_FIND_LIST m_oFilesFound;
VM_FILE_FIND_ITER m_oFilesIter;
VM_FILE_FIND_LIST m_oDirsFound;
VM_FILE_FIND_ITER m_oDirsIter;
bool m_bRecurse;
char m_achMask[ MAX_PATH + 1 ];
char m_achCurSearchDir[ MAX_PATH + 1 ];
char m_achCurrentDir[ MAX_PATH + 1 ];
bool m_bFirstSet;
};
#endif
/*****************************************************************************/
/* Check-in history */
/*
*$Log: $
*/
/*****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -