Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Dirent_Selector Class Reference

Define a portable C++ directory-entry iterator based on the POSIX scandir API. More...

#include <Dirent_Selector.h>

Collaboration diagram for ACE_Dirent_Selector:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Dirent_Selector (void)
 Constructor. More...

virtual ~ACE_Dirent_Selector (void)
 Destructor. More...

int length (void) const
 Return the length of the list of matching directory entries. More...

direntoperator[] (const int index) const
 Return the entry at index. More...

int close (void)
 Free up resources. More...

int open (const ACE_TCHAR *dir, int(*selector)(const dirent *d)=0, int(*comparator)(const dirent **d1, const dirent **d2)=0)
 Open the directory dir and populate the <namelist_> array with directory entries that match the selector and comparator. More...


Protected Attributes

dirent ** namelist_
 Ptr to the namelist array. More...

int n_
 # of entries in the array. More...


Detailed Description

Define a portable C++ directory-entry iterator based on the POSIX scandir API.

Definition at line 31 of file Dirent_Selector.h.


Constructor & Destructor Documentation

ACE_Dirent_Selector::ACE_Dirent_Selector void   
 

Constructor.

Definition at line 17 of file Dirent_Selector.cpp.

00018   : namelist_ (0),
00019     n_ (0)
00020 {
00021 }

ACE_Dirent_Selector::~ACE_Dirent_Selector void    [virtual]
 

Destructor.

Definition at line 23 of file Dirent_Selector.cpp.

00024 {
00025 }


Member Function Documentation

int ACE_Dirent_Selector::close void   
 

Free up resources.

Definition at line 38 of file Dirent_Selector.cpp.

References ACE_OS_Memory::free, and n_.

00039 {
00040   for (--n_; n_>=0; --n_)
00041     ACE_OS::free (this->namelist_[n_]);
00042 
00043   ACE_OS::free (this->namelist_);
00044   return 0;
00045 }

ACE_INLINE int ACE_Dirent_Selector::length void    const
 

Return the length of the list of matching directory entries.

Definition at line 6 of file Dirent_Selector.inl.

References n_.

00007 {
00008   return n_;
00009 }

int ACE_Dirent_Selector::open const ACE_TCHAR   dir,
int(*    selector)(const dirent *d) = 0,
int(*    comparator)(const dirent **d1, const dirent **d2) = 0
 

Open the directory dir and populate the <namelist_> array with directory entries that match the selector and comparator.

Definition at line 28 of file Dirent_Selector.cpp.

References ACE_TCHAR, n_, and ACE_OS_Dirent::scandir.

00032 {
00033   n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp);
00034   return n_;
00035 }

ACE_INLINE dirent * ACE_Dirent_Selector::operator[] const int    index const
 

Return the entry at index.

Definition at line 12 of file Dirent_Selector.inl.

References namelist_.

00013 {
00014   return this->namelist_[n];
00015 }


Member Data Documentation

int ACE_Dirent_Selector::n_ [protected]
 

# of entries in the array.

Definition at line 60 of file Dirent_Selector.h.

Referenced by close, length, and open.

dirent** ACE_Dirent_Selector::namelist_ [protected]
 

Ptr to the namelist array.

Definition at line 57 of file Dirent_Selector.h.

Referenced by operator[].


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:47:13 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002