2011-11-02 12:36:02 +04:00
|
|
|
/*
|
2014-06-19 03:10:45 +04:00
|
|
|
* Copyright 2011-2014 Haiku, Inc. All rights reserved.
|
2011-11-02 12:36:02 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Erik Jaesler, ejakowatz@users.sourceforge.net
|
|
|
|
* John Scipione, jscipione@gmail.com
|
|
|
|
*
|
|
|
|
* Corresponds to:
|
2014-06-19 03:10:45 +04:00
|
|
|
* headers/os/storage/EntryList.h hrev47402
|
|
|
|
* src/kits/storage/EntryList.cpp hrev47402
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\file EntryList.h
|
2013-02-07 06:05:00 +04:00
|
|
|
\ingroup storage
|
|
|
|
\ingroup libbe
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief Defines the BEntryList class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class BEntryList
|
|
|
|
\ingroup storage
|
|
|
|
\ingroup libbe
|
|
|
|
\brief 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.
|
2014-06-19 03:10:45 +04:00
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BEntryList::BEntryList()
|
|
|
|
\brief Creates a BEntryList object.
|
|
|
|
|
|
|
|
Does nothing at this time.
|
2014-06-19 03:10:45 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn BEntryList::~BEntryList()
|
|
|
|
\brief Frees all resources associated with the BEntryList object.
|
|
|
|
|
|
|
|
Does nothing at this time.
|
2014-06-19 03:10:45 +04:00
|
|
|
|
|
|
|
\since Haiku R1
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BEntryList::GetNextEntry(BEntry *entry, bool traverse)
|
|
|
|
\brief Returns the BEntryList's next entry as a BEntry.
|
|
|
|
|
|
|
|
Places the next entry in the list in \a entry, traversing symlinks if
|
|
|
|
\a traverse is \c true.
|
|
|
|
|
|
|
|
\param entry a pointer to a BEntry to be initialized with the found entry.
|
|
|
|
\param traverse specifies whether to follow it, if the found entry
|
2014-06-19 03:10:45 +04:00
|
|
|
is a symbolic link.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\note The iterator used by this method is the same one used by
|
2014-06-19 03:10:45 +04:00
|
|
|
GetNextRef(), GetNextDirents(), Rewind() and CountEntries().
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\retval B_OK if successful
|
|
|
|
\retval B_ENTRY_NOT_FOUND when at the end of the list
|
|
|
|
\retval B_ERROR or another error code (depending on the implementation
|
2014-06-19 03:10:45 +04:00
|
|
|
of the derived class).
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BEntryList::GetNextRef(entry_ref *ref)
|
|
|
|
\brief Returns the BEntryList's next entry as an entry_ref.
|
|
|
|
|
|
|
|
Places an entry_ref to the next entry in the list into \a ref.
|
|
|
|
|
|
|
|
\param ref a pointer to an entry_ref to be filled in with the data of the
|
2014-06-19 03:10:45 +04:00
|
|
|
found entry.
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\note The iterator used by this method is the same one used by
|
2014-06-19 03:10:45 +04:00
|
|
|
GetNextEntry(), GetNextDirents(), Rewind() and CountEntries().
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\retval B_OK if successful
|
|
|
|
\retval B_ENTRY_NOT_FOUND when at the end of the list
|
|
|
|
\retval B_ERROR or another error code (depending on the implementation
|
2014-06-19 03:10:45 +04:00
|
|
|
of the derived class).
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BEntryList::GetNextDirents(struct dirent *buf, size_t length,
|
2014-06-19 03:10:45 +04:00
|
|
|
int32 count)
|
2011-11-02 12:36:02 +04:00
|
|
|
\brief Returns the BEntryList's next entries as dirent structures.
|
|
|
|
|
|
|
|
Reads a number of entries into the array of dirent structures pointed
|
|
|
|
to by \a buf. Reads as many but no more than \a count entries, as many
|
|
|
|
entries as remain, or as many entries as will fit into the array at
|
|
|
|
\a buf with given length \a length (in bytes), whichever is smallest.
|
|
|
|
|
|
|
|
\param buf A pointer to a buffer to be filled with dirent structures of
|
2014-06-19 03:10:45 +04:00
|
|
|
the found entries.
|
2011-11-02 12:36:02 +04:00
|
|
|
\param length The length of the \a buf array.
|
|
|
|
\param count the maximum number of entries to be read.
|
|
|
|
|
|
|
|
\note The iterator used by this method is the same one used by
|
2014-06-19 03:10:45 +04:00
|
|
|
GetNextEntry(), GetNextRef(), Rewind() and CountEntries().
|
2011-11-02 12:36:02 +04:00
|
|
|
|
|
|
|
\returns
|
2014-06-19 03:10:45 +04:00
|
|
|
- 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
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn status_t BEntryList::Rewind()
|
|
|
|
\brief Rewinds the list pointer to the beginning of the list.
|
|
|
|
|
|
|
|
\retval B_OK if successful
|
|
|
|
\retval B_ERROR or another error code (depending on the implementation
|
2014-06-19 03:10:45 +04:00
|
|
|
of the derived class).
|
|
|
|
|
|
|
|
\since BeOS R3
|
2011-11-02 12:36:02 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\fn int32 BEntryList::CountEntries()
|
|
|
|
\brief Returns the number of entries in the list
|
|
|
|
|
|
|
|
\retval B_OK if successful
|
|
|
|
\retval B_ENTRY_NOT_FOUND when at the end of the list
|
|
|
|
\retval B_ERROR or another error code (depending on the implementation
|
2014-06-19 03:10:45 +04:00
|
|
|
of the derived class).
|
|
|
|
|
|
|
|
\since BeOS R3
|
|
|
|
*/
|