Public Member Functions | List of all members
BEntryList Class Referenceabstract

Interface for iterating through a list of filesystem entries. More...

Inherited by BDirectory, and BQuery.

Public Member Functions

 BEntryList ()
 Creates a BEntryList object. More...
 
virtual ~BEntryList ()
 Frees all resources associated with the BEntryList object. More...
 
virtual int32 CountEntries ()=0
 Returns the number of entries in the list. More...
 
virtual int32 GetNextDirents (struct dirent *direntBuffer, size_t bufferSize, int32 maxEntries=INT_MAX)=0
 Returns the BEntryList's next entries as dirent structures. More...
 
virtual status_t GetNextEntry (BEntry *entry, bool traverse=false)=0
 Returns the BEntryList's next entry as a BEntry. More...
 
virtual status_t GetNextRef (entry_ref *ref)=0
 Returns the BEntryList's next entry as an entry_ref. More...
 
virtual status_t Rewind ()=0
 Rewinds the list pointer to the beginning of the list. More...
 

Detailed Description

Interface for iterating through a list of filesystem entries.

Interface for iterating through a list of filesystem entries Defines a general interface for iterating through a list of entries (i.e. files in a folder

Defines a general interface for iterating through a list of entries i.e. files in a folder.

Since
BeOS R3

Constructor & Destructor Documentation

◆ BEntryList()

BEntryList::BEntryList ( )

Creates a BEntryList object.

Does nothing at this time.

Since
Haiku R1

◆ ~BEntryList()

BEntryList::~BEntryList ( )
virtual

Frees all resources associated with the BEntryList object.

Does nothing at this time.

Since
Haiku R1

Member Function Documentation

◆ CountEntries()

int32 BEntryList::CountEntries ( )
pure virtual

Returns the number of entries in the list.

Return values
B_OKif successful
B_ENTRY_NOT_FOUNDwhen at the end of the list
B_ERRORor another error code (depending on the implementation of the derived class).
Since
BeOS R3

Implemented in BQuery, and BDirectory.

◆ GetNextDirents()

int32 BEntryList::GetNextDirents ( struct dirent *  buf,
size_t  length,
int32  count = INT_MAX 
)
pure virtual

Returns the BEntryList's next entries as dirent structures.

Reads a number of entries into the array of dirent structures pointed to by buf. Reads as many but no more than count entries, as many entries as remain, or as many entries as will fit into the array at buf with given length length (in bytes), whichever is smallest.

Parameters
bufA pointer to a buffer to be filled with dirent structures of the found entries.
lengthThe length of the buf array.
countthe maximum number of entries to be read.
Note
The iterator used by this method is the same one used by GetNextEntry(), GetNextRef(), Rewind() and CountEntries().
Returns
  • The number of dirent structures stored in the buffer or 0 when there are no more entries to be read.
  • an error code (depending on the implementation of the derived class) if an error occurred.
Since
BeOS R3

Implemented in BQuery, and BDirectory.

◆ GetNextEntry()

status_t BEntryList::GetNextEntry ( BEntry entry,
bool  traverse = false 
)
pure virtual

Returns the BEntryList's next entry as a BEntry.

Places the next entry in the list in entry, traversing symlinks if traverse is true.

Parameters
entrya pointer to a BEntry to be initialized with the found entry.
traversespecifies whether to follow it, if the found entry is a symbolic link.
Note
The iterator used by this method is the same one used by GetNextRef(), GetNextDirents(), Rewind() and CountEntries().
Return values
B_OKif successful
B_ENTRY_NOT_FOUNDwhen at the end of the list
B_ERRORor another error code (depending on the implementation of the derived class).
Since
BeOS R3

Implemented in BQuery, and BDirectory.

◆ GetNextRef()

status_t BEntryList::GetNextRef ( entry_ref ref)
pure virtual

Returns the BEntryList's next entry as an entry_ref.

Places an entry_ref to the next entry in the list into ref.

Parameters
refa pointer to an entry_ref to be filled in with the data of the found entry.
Note
The iterator used by this method is the same one used by GetNextEntry(), GetNextDirents(), Rewind() and CountEntries().
Return values
B_OKif successful
B_ENTRY_NOT_FOUNDwhen at the end of the list
B_ERRORor another error code (depending on the implementation of the derived class).
Since
BeOS R3

Implemented in BQuery, and BDirectory.

◆ Rewind()

status_t BEntryList::Rewind ( )
pure virtual

Rewinds the list pointer to the beginning of the list.

Return values
B_OKif successful
B_ERRORor another error code (depending on the implementation of the derived class).
Since
BeOS R3

Implemented in BQuery, and BDirectory.