diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-07-09 20:02:29 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-07-09 20:02:29 +0000 |
commit | b161743f263428a37c8b56c5d2b31698a81000b4 (patch) | |
tree | f5daf4d0718ce49c9614f7ac85c78dc9e1a5e550 /ace/Dirent_Selector.h | |
parent | 1ca4201b746610bd8e569f91942ad5bee7c44d82 (diff) | |
download | ATCD-b161743f263428a37c8b56c5d2b31698a81000b4.tar.gz |
ChangeLogTag:Mon Jul 9 06:52:09 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
Diffstat (limited to 'ace/Dirent_Selector.h')
-rw-r--r-- | ace/Dirent_Selector.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/ace/Dirent_Selector.h b/ace/Dirent_Selector.h new file mode 100644 index 00000000000..6f3ea0872fa --- /dev/null +++ b/ace/Dirent_Selector.h @@ -0,0 +1,64 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Dirent_Selector.h + * + * $Id$ + * + * Define a portable C++ interface to the <ACE_OS_Dirent::scandir> method. + * + * @author Rich Newman <RNewman@directv.com> + */ +//============================================================================= + +#ifndef ACE_DIRENT_SELECTOR_H +#define ACE_DIRENT_SELECTOR_H +#include "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class ACE_Dirent + * + * @brief Define a portable C++ directory-entry iterator based on the POSIX <scandir> API. + */ +class ACE_Export ACE_Dirent_Selector +{ +public: + /// Constructor + ACE_Dirent_Selector (void); + + /// Destructor. + virtual ~ACE_Dirent_Selector (void); + + /// Return the length of the list of matching directory entries. + int length (void) const; + + /// Return the entry at <index>. + dirent *operator[] (const int index) const; + + /// Free up resources. + int close (void); + + /// Open the director <dir> and populate the <namelist_> array with + /// directory entries that match the <selector> and <comparator>. + int open (const ACE_TCHAR *dir, + int (*selector)(const dirent *d) = 0, + int (*comparator)(const dirent **d1, const dirent **d2) = 0); + +protected: + /// Ptr to the namelist array. + dirent **namelist_; + + /// # of entries in the array. + int n_; +}; + +#include "ace/Dirent_Selector.inl" + +#include "ace/post.h" +#endif /* ACE_DIRENT_SELECTOR_H */ + |