2 #include "ace/Log_Category.h"
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 ACE_Dirent::open (const ACE_TCHAR *dirname)
9 // If the directory stream is already open, close it to prevent
10 // possible resource leaks.
13 ACE_OS::closedir (this->dirp_);
14 this->dirp_ = nullptr;
17 this->dirp_ = ACE_OS::opendir (dirname);
26 ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname)
28 if (this->open (dirname) == -1)
29 ACELIB_ERROR ((LM_ERROR,
31 ACE_TEXT ("ACE_Dirent::ACE_Dirent")));
35 ACE_Dirent::~ACE_Dirent ()
38 ACE_OS::closedir (this->dirp_);
41 ACE_INLINE ACE_DIRENT *
44 return this->dirp_ ? ACE_OS::readdir (this->dirp_) : nullptr;
52 ACE_OS::closedir (this->dirp_);
54 // Prevent double closure
55 this->dirp_ = nullptr;
63 ACE_OS::rewinddir (this->dirp_);
67 ACE_Dirent::seek (long loc)
70 ACE_OS::seekdir (this->dirp_, loc);
76 return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0;
79 ACE_END_VERSIONED_NAMESPACE_DECL