Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Dirent_Selector.h
blob2751a53272ea89f44a086964b872a743b4cf7269
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Dirent_Selector.h
7 * Define a portable C++ interface to the <ACE_OS::scandir> method.
9 * @author Rich Newman <RNewman@directv.com>
11 //=============================================================================
13 #ifndef ACE_DIRENT_SELECTOR_H
14 #define ACE_DIRENT_SELECTOR_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "ace/OS_NS_dirent.h" /* Need ACE_SCANDIR_SELECTOR, COMPARATOR */
24 #include "ace/os_include/os_dirent.h"
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 /**
29 * @class ACE_Dirent_Selector
31 * @brief Define a portable C++ directory-entry iterator based on the
32 * POSIX scandir API.
34 class ACE_Export ACE_Dirent_Selector
36 public:
37 /// Constructor
38 ACE_Dirent_Selector () = default;
40 /// Destructor.
41 virtual ~ACE_Dirent_Selector ();
43 /// Return the length of the list of matching directory entries.
44 int length () const;
46 /// Return the entry at @a index.
47 ACE_DIRENT *operator[] (const int index) const;
49 /// Free up resources.
50 int close ();
52 /// Open the directory @a dir and populate the current list of names with
53 /// directory entries that match the @a selector and @a comparator.
54 int open (const ACE_TCHAR *dir,
55 ACE_SCANDIR_SELECTOR selector = 0,
56 ACE_SCANDIR_COMPARATOR comparator = 0);
58 protected:
59 /// Ptr to the namelist array.
60 ACE_DIRENT **namelist_ {};
62 /// Number of entries in the array.
63 int n_ {};
66 ACE_END_VERSIONED_NAMESPACE_DECL
68 #if defined (__ACE_INLINE__)
69 #include "ace/Dirent_Selector.inl"
70 #endif /* __ACE_INLINE__ */
72 #include /**/ "ace/post.h"
73 #endif /* ACE_DIRENT_SELECTOR_H */