Changeset 680 in dev


Ignore:
Timestamp:
Jul 12, 2008, 9:22:58 PM (16 years ago)
Author:
dai_9181
Message:

Directory::SearchFilesメソッドを追加。

Location:
trunk/ab5.0/jenga
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/jenga/include/common/Directory.h

    r620 r680  
    1818    std::string GetFullPath( const std::string &relationPath ) const;
    1919    std::string GetRelationalPath( const std::string &fullPath ) const;
     20
     21    void SearchFiles( Jenga::Common::Strings &resultOfFullPath, const std::string &findStr, bool isRecuresive = false ) const;
    2022};
    2123
  • trunk/ab5.0/jenga/include/jenga.h

    r625 r680  
    44#include "common/BoostSerializationSupport.h"
    55#include "common/CmdLine.h"
     6#include "common/String.h"
    67#include "common/Directory.h"
    78#include "common/EasyToken.h"
     
    1213#include "common/Path.h"
    1314#include "common/SourceTemplate.h"
    14 #include "common/String.h"
    1515#include "common/VectorSupporter.h"
  • trunk/ab5.0/jenga/src/common/Directory.cpp

    r620 r680  
    138138    return temp;
    139139}
     140
     141void Directory::SearchFiles( Jenga::Common::Strings &resultOfFullPath, const std::string &findStr, bool isRecuresive ) const
     142{
     143    Jenga::Common::Strings result;
     144
     145    WIN32_FIND_DATA wfd;
     146    HANDLE hFind=FindFirstFile( ( this->path + "\\" + findStr ).c_str(), &wfd );
     147    if( hFind != INVALID_HANDLE_VALUE )
     148    {
     149        do
     150        {
     151            if( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
     152            {
     153                // ディレクトリのとき
     154                if( isRecuresive )
     155                {
     156                    Directory tempDir( this->path + "\\" + wfd.cFileName );
     157                    tempDir.SearchFiles( resultOfFullPath, findStr, isRecuresive );
     158                }
     159            }
     160            else
     161            {
     162                //ファイルのとき
     163                resultOfFullPath.push_back( this->path + "\\" + wfd.cFileName );
     164            }
     165        } while( FindNextFile( hFind, &wfd ) );
     166
     167        FindClose( hFind );
     168    }
     169}
Note: See TracChangeset for help on using the changeset viewer.