#include <Dirent_Selector.h>
Public Member Functions | |
ACE_Dirent_Selector (void) | |
Constructor. | |
virtual | ~ACE_Dirent_Selector (void) |
Destructor. | |
int | length (void) const |
Return the length of the list of matching directory entries. | |
ACE_DIRENT * | operator[] (const int index) const |
Return the entry at index. | |
int | close (void) |
Free up resources. | |
int | open (const ACE_TCHAR *dir, int(*selector)(const ACE_DIRENT *d)=0, int(*comparator)(const ACE_DIRENT **d1, const ACE_DIRENT **d2)=0) |
Protected Attributes | |
ACE_DIRENT ** | namelist_ |
Ptr to the namelist array. | |
int | n_ |
Number of entries in the array. |
Definition at line 35 of file Dirent_Selector.h.
|
Constructor.
Definition at line 20 of file Dirent_Selector.cpp.
|
|
Destructor.
Definition at line 26 of file Dirent_Selector.cpp. References close().
00027 { 00028 // Free up any allocated resources. 00029 this->close(); 00030 } |
|
Free up resources.
Definition at line 43 of file Dirent_Selector.cpp. References ACE_OS::free(), n_, and namelist_. Referenced by ~ACE_Dirent_Selector().
00044 { 00045 for (--n_; n_ >= 0; --n_) 00046 { 00047 #if defined (ACE_LACKS_STRUCT_DIR) 00048 // Only the lacking-struct-dir emulation allocates this. Native 00049 // scandir includes d_name in the dirent struct itself. 00050 ACE_OS::free (this->namelist_[n_]->d_name); 00051 #endif 00052 ACE_OS::free (this->namelist_[n_]); 00053 } 00054 00055 ACE_OS::free (this->namelist_); 00056 this->namelist_ = 0; 00057 return 0; 00058 } |
|
Return the length of the list of matching directory entries.
Definition at line 8 of file Dirent_Selector.inl. References n_.
00009 { 00010 return n_; 00011 } |
|
Open the directory dir and populate the array with directory entries that match the selector and comparator. Definition at line 33 of file Dirent_Selector.cpp. References ACE_TCHAR, n_, and ACE_OS::scandir().
00037 { 00038 n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp); 00039 return n_; 00040 } |
|
Return the entry at index.
Definition at line 14 of file Dirent_Selector.inl. References namelist_.
00015 { 00016 return this->namelist_[n]; 00017 } |
|
Number of entries in the array.
Definition at line 64 of file Dirent_Selector.h. |
|
Ptr to the namelist array.
Definition at line 61 of file Dirent_Selector.h. Referenced by close(), and operator[](). |