#include <Dirent.h>
Public Member Functions | |
ACE_Dirent (void) | |
Default constructor. | |
ACE_Dirent (const ACE_TCHAR *dirname) | |
Constructor calls . | |
int | open (const ACE_TCHAR *filename) |
~ACE_Dirent (void) | |
Destructor calls . | |
void | close (void) |
Closes the directory stream and frees the structure. | |
ACE_DIRENT * | read (void) |
int | read (struct ACE_DIRENT *entry, struct ACE_DIRENT **result) |
long | tell (void) |
void | seek (long loc) |
void | rewind (void) |
Private Attributes | |
ACE_DIR * | dirp_ |
Pointer to the directory stream. |
Definition at line 35 of file Dirent.h.
|
Default constructor.
Definition at line 30 of file Dirent.inl.
00031 : dirp_ (0) 00032 { 00033 } |
|
Constructor calls .
Definition at line 36 of file Dirent.inl. References ACE_ERROR, ACE_TCHAR, ACE_TEXT, LM_ERROR, and open().
|
|
Destructor calls .
Definition at line 46 of file Dirent.inl. References ACE_OS::closedir(), and dirp_.
00047 { 00048 if (this->dirp_ != 0) 00049 ACE_OS::closedir (this->dirp_); 00050 } |
|
Closes the directory stream and frees the structure.
Definition at line 68 of file Dirent.inl. References ACE_OS::closedir(), and dirp_.
00069 { 00070 if (this->dirp_ != 0) 00071 { 00072 ACE_OS::closedir (this->dirp_); 00073 00074 // Prevent double closure 00075 this->dirp_ = 0; 00076 } 00077 } |
|
Opens the directory named by filename and associates a directory stream with it. Definition at line 10 of file Dirent.inl. References ACE_TCHAR, ACE_OS::closedir(), dirp_, and ACE_OS::opendir(). Referenced by ACE_Dirent().
00011 { 00012 // If the directory stream is already open, close it to prevent 00013 // possible resource leaks. 00014 00015 if (this->dirp_ != 0) 00016 { 00017 ACE_OS::closedir (this->dirp_); 00018 this->dirp_ = 0; 00019 } 00020 00021 this->dirp_ = ACE_OS::opendir (dirname); 00022 00023 if (this->dirp_ == 0) 00024 return -1; 00025 else 00026 return 0; 00027 } |
|
Has the equivalent functionality as except that an and buffer must be supplied by the caller to store the result. Definition at line 59 of file Dirent.inl. References dirp_, and ACE_OS::readdir_r().
00061 { 00062 return this->dirp_ 00063 ? ACE_OS::readdir_r (this->dirp_, entry, result) 00064 : 0; 00065 } |
|
Returns a pointer to a structure representing the directory entry at the current position in the directory stream to which dirp refers, and positions the directory stream at the next entry, except on read-only filesystems. It returns a NULL pointer upon reaching the end of the directory stream, or upon detecting an invalid location in the directory. shall not return directory entries containing empty names. It is unspecified whether entries are returned for dot or dot-dot. The pointer returned by points to data that may be overwritten by another call to on the same directory stream. This data shall not be overwritten by another call to on a different directory stream. may buffer several directory entries per actual read operation; marks for update the st_atime field of the directory each time the directory is actually read. Definition at line 53 of file Dirent.inl. References dirp_, and ACE_OS::readdir().
00054 { 00055 return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; 00056 } |
|
Resets the position of the directory stream to the beginning of the directory. It also causes the directory stream to refer to the current state of the corresponding directory, as a call to would. Definition at line 80 of file Dirent.inl. References dirp_, and ACE_OS::rewinddir().
00081 { 00082 if (this->dirp_) 00083 ACE_OS::rewinddir (this->dirp_); 00084 } |
|
Sets the position of the next operation on the directory stream. The new position reverts to the position associated with the directory stream at the time the operation that provides loc was performed. Values returned by are good only for the lifetime of the pointer from which they are derived. If the directory is closed and then reopened, the value may be invalidated due to undetected directory compaction. It is safe to use a previous value immediately after a call to and before any calls to readdir. Definition at line 87 of file Dirent.inl. References dirp_, and ACE_OS::seekdir().
00088 { 00089 if (this->dirp_) 00090 ACE_OS::seekdir (this->dirp_, loc); 00091 } |
|
Returns the current location associated with the directory stream. Definition at line 94 of file Dirent.inl. References dirp_, and ACE_OS::telldir().
00095 { 00096 return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0; 00097 } |
|
Pointer to the directory stream.
Definition at line 112 of file Dirent.h. Referenced by close(), open(), read(), rewind(), seek(), tell(), and ~ACE_Dirent(). |