51 if ( m_pff != NULL && ! m_pff->
IsFinding() )
58 if ( m_pff == NULL ) {
return NULL; }
59 return &(m_pff->
Get());
68 if ( m_pff != NULL && ! m_pff->
Next() ) { m_pff = NULL; }
75 bool operator==(
const iterator& i)
const
77 return m_pff == i.m_pff;
79 bool operator!=(
const iterator& i)
const
81 return ! operator==(i);
144 if ( lpszMask != NULL )
146 if ( lpszMask[0] !=
'\\' && lpszMask[0] !=
'/' )
151 s.
Replace(_T(
"\\\\"), _T(
"\\"));
156 m_strPath = lpszPath;
157 m_strMask = lpszMask;
159 if ( m_IsTarget(m_data, m_type) )
189 else if ( m_IsTarget(m_data, m_type) )
213 const WIN32_FIND_DATA&
Get(
void)
const
238 s +=
Get().cFileName;
239 s.
Replace(_T(
"\\\\"), _T(
"\\"));
252 if (
IsFinding() && (
Get().dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 )
265 virtual HFINDPUSH Push(
void) {
return NULL; };
272 virtual void Pop(HFINDPUSH h) {};
284 virtual bool OnStart(WIN32_FIND_DATA& _data, LPCTSTR lpszName) = 0;
294 virtual bool OnNext(WIN32_FIND_DATA& _data) = 0;
308 WIN32_FIND_DATA m_data;
318 bool m_IsTarget(
const WIN32_FIND_DATA& data,
EFindType type)
const
331 if ( (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 )
337 if ( (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0 )
414 virtual bool OnStart(WIN32_FIND_DATA& _data, LPCTSTR lpszName)
417 m_hFind = ::FindFirstFile(lpszName, &_data);
418 return (m_hFind != INVALID_HANDLE_VALUE);
429 virtual bool OnNext(WIN32_FIND_DATA& _data)
431 if ( m_hFind != INVALID_HANDLE_VALUE )
433 return !! ::FindNextFile(m_hFind, &_data);
444 if ( m_hFind != INVALID_HANDLE_VALUE )
446 ::FindClose(m_hFind);
447 m_hFind = INVALID_HANDLE_VALUE;
457 virtual HFINDPUSH Push(
void)
461 TPushParam* P =
new TPushParam;
463 P->strPath = m_strPath;
466 m_strPath += _T(
"\\");
467 m_strPath += m_data.cFileName;
468 m_hFind = ::FindFirstFile(m_strPath, &m_data);
469 if ( m_hFind != INVALID_HANDLE_VALUE )
471 if ( ! IsTarget(m_data, m_type) )
480 m_strPath = P->strPath;
492 virtual void Pop(HFINDPUSH h)
496 TPushParam* P =
reinterpret_cast<TPushParam*
>(h);
498 m_strPath = P->strPath;
507 friend class CFileFinderTest;
515struct WIN32_FIND_DATA
517 DWORD dwFileAttributes;
525 TCHAR cFileName[ MAX_PATH ];
526 TCHAR cAlternateFileName[ 14 ];
531 FILE_ATTRIBUTE_ARCHIVE = 0x00000020,
532 FILE_ATTRIBUTE_COMPRESSED = 0x00000800,
533 FILE_ATTRIBUTE_DEVICE = 0x00000040,
534 FILE_ATTRIBUTE_DIRECTORY = 0x00000010,
535 FILE_ATTRIBUTE_ENCRYPTED = 0x00004000,
536 FILE_ATTRIBUTE_HIDDEN = 0x00000002,
537 FILE_ATTRIBUTE_NORMAL = 0x00000080,
538 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000,
539 FILE_ATTRIBUTE_OFFLINE = 0x00001000,
540 FILE_ATTRIBUTE_READONLY = 0x00000001,
541 FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400,
542 FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200,
543 FILE_ATTRIBUTE_SYSTEM = 0x00000004,
544 FILE_ATTRIBUTE_TEMPORARY = 0x00000100,
bool IsDirectory(void) const
[確認] ディレクトリか?
iterator begin(void)
[反復] 先頭iterator.
const WIN32_FIND_DATA & Get(void) const
[取得] 検索情報取得
virtual void OnFinish(void)=0
[通知] 検索終了通知
CStr GetFoundName(void) const
[取得] 検索ファイル名取得
void Finish(void)
[設定] 検索終了.
virtual bool OnStart(WIN32_FIND_DATA &_data, LPCTSTR lpszName)=0
[通知] 検索開始通知
virtual ~CAbstractFileFinder(void)
デストラクタ
bool Start(LPCTSTR lpszPath, LPCTSTR lpszMask=_T("*.*"), EFindType type=ALL)
[検索] 検索開始
bool IsFinding(void) const
[確認] 検索中確認
CAbstractFileFinder(void)
コンストラクタ
const WIN32_FIND_DATA * operator->(void) const
[取得] 検索情報取得
virtual bool OnNext(WIN32_FIND_DATA &_data)=0
[通知] 次検索通知
iterator end(void)
[反復] 最後iterator.
virtual ~CFileFinder(void)
デストラクタ
virtual void OnFinish(void)
[通知] 検索終了通知
virtual bool OnStart(WIN32_FIND_DATA &_data, LPCTSTR lpszName)
[通知] 検索開始通知
virtual bool OnNext(WIN32_FIND_DATA &_data)
[通知] 次検索通知
CStrT & TrimLeft(TYP t=' ')
[処理] 先頭から文字をトリム.
int Replace(TYP tOld, TYP tNew)
[処理] 文字置換.
int Compare(LPCSTR P1, LPCSTR P2, INT_PTR len=-1, DWORD dwCmpFlags=0)
[比較] 文字列比較(ASCII/SJIS用)
TNB::CStrT< TCHAR > CStr
文字列クラス
CValueAcceleration operator*(const CValueSpeed &s, const CValueFrequency &f)
[計算] 掛算 (加速度 = 速度 × 周波数) .