My Project
FileSearchResult.h
1 #pragma once
2 #include <vector>
3 #include <string>
4 #include <set>
5 
6 namespace ParaEngine
7 {
9  struct CFileFindData
10  {
11  std::string m_sFileName;
12  DWORD m_dwFileAttributes;
13  FILETIME m_ftCreationTime;
14  FILETIME m_ftLastAccessTime;
15  FILETIME m_ftLastWriteTime;
16  DWORD m_dwFileSize;
17  public:
18  CFileFindData(const std::string& sFileName, DWORD dwFileSize = 0, DWORD dwFileAttributes = 0, const FILETIME* ftLastWriteTime = 0, const FILETIME* ftCreationTime = 0, const FILETIME* ftLastAccessTime = 0);
19 
20  bool IsDirectory() const;
21  };
22 
25  {
26  public:
27  PE_CORE_DECL CSearchResult();
28  PE_CORE_DECL ~CSearchResult();
29  public:
31  PE_CORE_DECL void Release();
32 
34  PE_CORE_DECL const std::string& GetRootPath();
35 
37  PE_CORE_DECL int GetNumOfResult();
38 
40  PE_CORE_DECL bool AddResult(const CFileFindData& item);
41 
43  PE_CORE_DECL bool AddResult(const std::string& sItem, DWORD dwFileSize = 0, DWORD dwFileAttributes = 0, const FILETIME* ftLastWriteTime = 0, const FILETIME* ftCreationTime = 0, const FILETIME* ftLastAccessTime = 0);
44 
46  PE_CORE_DECL const CFileFindData* GetItemData(int nIndex);
47 
49  PE_CORE_DECL const std::string& GetItem(int nIndex);
50 
57  void InitSearch(const std::string& sRootPath, int nSubLevel = 0, int nMaxFilesNum = 50, int nFrom = 0);
58 
59  void SetRootPath(const std::string& sRoot);
60  protected:
61  std::string m_rootPath;
62  std::vector<CFileFindData> m_results;
63  std::set<std::string> m_filenames;
69  int m_nFrom;
71  int m_nFileNumber;
72  };
73 }
file find item
Definition: FileSearchResult.h:9
different physics engine has different winding order.
Definition: EventBinding.h:32
int m_nSubLevel
how many sub folders of sRootPath to look into. default value is 0, which only searches the sRootPath...
Definition: FileSearchResult.h:65
int m_nFrom
only contains results from nFrom to (nFrom+nMaxFilesNum)
Definition: FileSearchResult.h:69
Definition: PEtypes.h:145
it represents the search result.
Definition: FileSearchResult.h:24
int m_nMaxFilesNum
one can limit the total number of files in the search result. Default value is 50. the search will stop at this value even there are more matching files.
Definition: FileSearchResult.h:67