Dirent_Selector.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Dirent_Selector.h
00006  *
00007  *  Dirent_Selector.h,v 4.10 2006/02/10 10:05:58 jwillemsen 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 #include "ace/ACE_export.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 #pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "ace/os_include/os_dirent.h"
00026 
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 /**
00030  * @class ACE_Dirent_Selector
00031  *
00032  * @brief Define a portable C++ directory-entry iterator based on the
00033  * POSIX scandir API.
00034  */
00035 class ACE_Export ACE_Dirent_Selector
00036 {
00037 public:
00038   /// Constructor
00039   ACE_Dirent_Selector (void);
00040 
00041   /// Destructor.
00042   virtual ~ACE_Dirent_Selector (void);
00043 
00044   /// Return the length of the list of matching directory entries.
00045   int length (void) const;
00046 
00047   /// Return the entry at @a index.
00048   ACE_DIRENT *operator[] (const int index) const;
00049 
00050   /// Free up resources.
00051   int close (void);
00052 
00053   /// Open the directory @a dir and populate the <namelist_> array with
00054   /// directory entries that match the @a selector and @a comparator.
00055   int open (const ACE_TCHAR *dir,
00056             int (*selector)(const ACE_DIRENT *d) = 0,
00057             int (*comparator)(const ACE_DIRENT **d1, const ACE_DIRENT **d2) = 0);
00058 
00059 protected:
00060   /// Ptr to the namelist array.
00061   ACE_DIRENT **namelist_;
00062 
00063   /// Number of entries in the array.
00064   int n_;
00065 };
00066 
00067 ACE_END_VERSIONED_NAMESPACE_DECL
00068 
00069 #if defined (__ACE_INLINE__)
00070 #include "ace/Dirent_Selector.inl"
00071 #endif /* __ACE_INLINE__ */
00072 
00073 #include /**/ "ace/post.h"
00074 #endif /* ACE_DIRENT_SELECTOR_H */

Generated on Thu Nov 9 09:41:50 2006 for ACE by doxygen 1.3.6