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

Dirent_Selector.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Dirent_Selector.h
00006  *
00007  *  $Id: Dirent_Selector.h,v 1.1.1.2 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  Define a portable C++ interface to the <ACE_OS_Dirent::scandir> method.
00010  *
00011  *  @author Rich Newman <RNewman@directv.com>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef ACE_DIRENT_SELECTOR_H
00016 #define ACE_DIRENT_SELECTOR_H
00017 #include "ace/pre.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 #pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ace/ACE_export.h"
00024 
00025 /**
00026  * @class ACE_Dirent_Selector
00027  *
00028  * @brief Define a portable C++ directory-entry iterator based on the
00029  * POSIX scandir API.
00030  */
00031 class ACE_Export ACE_Dirent_Selector
00032 {
00033 public:
00034   /// Constructor
00035   ACE_Dirent_Selector (void);
00036 
00037   /// Destructor.
00038   virtual ~ACE_Dirent_Selector (void);
00039 
00040   /// Return the length of the list of matching directory entries.
00041   int length (void) const;
00042 
00043   /// Return the entry at @a index.
00044   dirent *operator[] (const int index) const;
00045 
00046   /// Free up resources.
00047   int close (void);
00048 
00049   /// Open the directory @a dir and populate the <namelist_> array with
00050   /// directory entries that match the @a selector and @a comparator.
00051   int open (const ACE_TCHAR *dir,
00052             int (*selector)(const dirent *d) = 0,
00053             int (*comparator)(const dirent **d1, const dirent **d2) = 0);
00054 
00055 protected:
00056   /// Ptr to the namelist array.
00057   dirent **namelist_;
00058 
00059   /// # of entries in the array.
00060   int n_;
00061 };
00062 
00063 #if defined (__ACE_INLINE__)
00064 #include "ace/Dirent_Selector.inl"
00065 #endif /* __ACE_INLINE__ */
00066 
00067 #include "ace/post.h"
00068 #endif /* ACE_DIRENT_SELECTOR_H */

Generated on Mon Jun 16 11:19:36 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002