My Project
Public Member Functions | Protected Attributes | List of all members
ParaEngine::CSearchResult Class Reference

it represents the search result. More...

#include <FileSearchResult.h>

Public Member Functions

PE_CORE_DECL void Release ()
 release results. More...
 
PE_CORE_DECL const std::string & GetRootPath ()
 get the root path
 
PE_CORE_DECL int GetNumOfResult ()
 get the total number of result found
 
PE_CORE_DECL bool AddResult (const CFileFindData &item)
 add a new item. More...
 
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)
 add a new item. More...
 
PE_CORE_DECL const CFileFindDataGetItemData (int nIndex)
 get the item at the specified index. More...
 
PE_CORE_DECL const std::string & GetItem (int nIndex)
 get the item at the specified index. More...
 
void InitSearch (const std::string &sRootPath, int nSubLevel=0, int nMaxFilesNum=50, int nFrom=0)
 clear previous search result and begin a new search More...
 
void SetRootPath (const std::string &sRoot)
 

Protected Attributes

std::string m_rootPath
 
std::vector< CFileFindDatam_results
 
std::set< std::string > m_filenames
 
int m_nSubLevel
 how many sub folders of sRootPath to look into. default value is 0, which only searches the sRootPath folder.
 
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.
 
int m_nFrom
 only contains results from nFrom to (nFrom+nMaxFilesNum)
 
int m_nFileNumber
 

Detailed Description

it represents the search result.

Member Function Documentation

§ AddResult() [1/2]

bool CSearchResult::AddResult ( const CFileFindData item)

add a new item.

return false if the search is completed.

§ AddResult() [2/2]

PE_CORE_DECL bool ParaEngine::CSearchResult::AddResult ( const std::string &  sItem,
DWORD  dwFileSize = 0,
DWORD  dwFileAttributes = 0,
const FILETIME ftLastWriteTime = 0,
const FILETIME ftCreationTime = 0,
const FILETIME ftLastAccessTime = 0 
)

add a new item.

return false if the search is completed.

§ GetItem()

const string & CSearchResult::GetItem ( int  nIndex)

get the item at the specified index.

return "" if nIndex is out of range.

§ GetItemData()

const CFileFindData * CSearchResult::GetItemData ( int  nIndex)

get the item at the specified index.

return NULL if nIndex is out of range.

§ InitSearch()

void CSearchResult::InitSearch ( const std::string &  sRootPath,
int  nSubLevel = 0,
int  nMaxFilesNum = 50,
int  nFrom = 0 
)

clear previous search result and begin a new search

Parameters
sRootPaththe root path. for example: "", "xmodel/","xmodel/models/". Other format is not acceptable
nSubLevelhow many sub folders of sRootPath to look into. default value is 0, which only searches the sRootPath folder.
nMaxFilesNumone 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.
nFromonly contains results from nFrom to (nFrom+nMaxFilesNum)

§ Release()

void CSearchResult::Release ( )

release results.


The documentation for this class was generated from the following files: