00001 // 00002 // CascadeDirScanner.h - header file for class CascadeDirScanner 00003 // 00004 // Copyright (c) 2003, Roku, LLC. All rights reserved. 00005 // 00007 00008 #ifndef _ROKU_INCLUDE_CASCADE_UTIL_CASCADEDIRSCANNER_H 00009 #define _ROKU_INCLUDE_CASCADE_UTIL_CASCADEDIRSCANNER_H 00010 00011 #include <cascade/CascadeObject.h> 00012 00014 // class CascadeDirScanner 00015 class CascadeDirScanner : public CascadeObject 00016 { 00017 public: 00018 CascadeDirScanner(const char * pDirName); 00019 // construct CascadeDirScanner passing in a directory name as pDirName 00020 // CascadeDirScanner will scan the directory and remember all of the 00021 // directory entries (files) encountered. 00022 00023 CascadeDirScanner(const char * pDirName, const char * pMatchPrefix); 00024 // construct CascadeDirScanner with a pMatchPrefix and it will only 00025 // remember files whose prefix matches *pMatchPrefix 00026 00027 virtual ~CascadeDirScanner(); 00028 // Memory allocated by the dir scanner doesn't get freed until 00029 // the dir scanner is destructed, so don't keep 'em around forever! 00030 00031 public: 00032 u32 GetNumEntries(); 00033 // GetNumEntries() returns the number of entries found during the directory scan. 00034 00035 const char * GetEntry(u32 nIndex); 00036 // GetEntry() returns the name of the entry found at index nIndex. 00037 // Entries are sorted alphabetically. 00038 // NOTE: do not cache the const char * returned from GetEntry() as it will 00039 // be freed when this is destructed. 00040 00041 private: 00042 void * m_pDirScannerInternal; 00043 }; 00044 00045 #endif // #ifndef _ROKU_INCLUDE_CASCADE_UTIL_CASCADEDIRSCANNER_H 00046 00048 // LOG 00050 // 28-Jan-03 dwoodward created