diff options
| author | Rat <none@none> | 2010-06-07 19:10:55 +0200 |
|---|---|---|
| committer | Rat <none@none> | 2010-06-07 19:10:55 +0200 |
| commit | 32546e22828e793e3881e1055acb72b6a044e331 (patch) | |
| tree | 759706cdfe8423887c69a2f8ed651c0c1e5ab7d7 /externals/ace/Dirent_Selector.cpp | |
| parent | 2e0f8fb6e558088b33bdee83bc5ff20014e983b3 (diff) | |
added ace + vcproj for win
--HG--
branch : trunk
Diffstat (limited to 'externals/ace/Dirent_Selector.cpp')
| -rw-r--r-- | externals/ace/Dirent_Selector.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/externals/ace/Dirent_Selector.cpp b/externals/ace/Dirent_Selector.cpp new file mode 100644 index 00000000000..8fcb5775b29 --- /dev/null +++ b/externals/ace/Dirent_Selector.cpp @@ -0,0 +1,59 @@ +// $Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $ + +#include "ace/Dirent_Selector.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Dirent_Selector.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/OS_NS_dirent.h" +#include "ace/OS_NS_stdlib.h" + +ACE_RCSID (ace, + Dirent_Selector, + "$Id: Dirent_Selector.cpp 80826 2008-03-04 14:51:23Z wotte $") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Construction/Destruction + +ACE_Dirent_Selector::ACE_Dirent_Selector (void) + : namelist_ (0), + n_ (0) +{ +} + +ACE_Dirent_Selector::~ACE_Dirent_Selector (void) +{ + // Free up any allocated resources. + this->close(); +} + +int +ACE_Dirent_Selector::open (const ACE_TCHAR *dir, + ACE_SCANDIR_SELECTOR sel, + ACE_SCANDIR_COMPARATOR cmp) +{ + n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp); + return n_; +} + +int +ACE_Dirent_Selector::close (void) +{ + for (--n_; n_ >= 0; --n_) + { +#if defined (ACE_LACKS_STRUCT_DIR) + // Only the lacking-struct-dir emulation allocates this. Native + // scandir includes d_name in the dirent struct itself. + ACE_OS::free (this->namelist_[n_]->d_name); +#endif + ACE_OS::free (this->namelist_[n_]); + } + + ACE_OS::free (this->namelist_); + this->namelist_ = 0; + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL |
