// // Copyright 2007, Haiku Inc. All Rights Reserved. // // Distributed under the terms of the MIT License. // // // Documentation by: // Niels Sascha Reedijk 6(G) would result in this: \verbatim A C D E F G B H I J \endverbatim \param fromIndex The original location. \param toIndex The new location. \retval true Move succeeded. \retval false Move failed since the indexes were invalid. */ //! @} /*! \name Retrieving items */ //! @{ /*! \fn void *BList::ItemAt(int32 index) const \brief Get an item. \param index The item to retrieve. \return A pointer to the item in that position, or \c NULL if the index is out of bounds. \see ItemAtFast(int32 index) const */ /*! \fn void *BList::FirstItem() const \brief Get the first item. \return A pointer to the first item, or \c NULL if the list is empty. */ /*! \fn void *BList::ItemAtFast(int32 index) const \brief Get an item. This method does not performs any boundary checks when it retrieves an item. Use this method in a performance critical area of your program where you are sure you won't get an invalid item. \return A pointer to the item. */ /*! \fn void *BList::LastItem() const \brief Get the last item. \return A pointer to the last item, or \c NULL if the list is empty. */ /*! \fn void *BList::Items() const \brief Return the internal list of objects. This method will return a pointer to the internal pointer list. This means you should be careful what you are doing, since you are directly working with the internals of the class. It is definately not a good idea to make any changes to the list, since it will mess up the internal consistency. \warning If there is anything you want for which you need the list of objects, please realize that that probably means that what you want to do is a bad idea to begin with. Avoid this method. The list of objects doesn't belong to you. Check if DoForEach() can help you. \return The internal list of pointers. */ //! @} /*! \name Querying for items */ //! @{ /*! \fn bool BList::HasItem(void *item) const \brief Check if an item is in the list. */ /*! \fn int32 BList::IndexOf(void *item) const \brief Get the index of an item. \return The index of the item, or -1 when the item is not in the list. */ /*! \fn int32 BList::CountItems() const \brief Get the number of items in the list. */ /*! \fn bool BList::IsEmpty() const \brief Check if there are items in the list. */ //! @} /*! \name Iterating over the list */ //! @{ /*! \fn void BList::DoForEach(bool (*func)(void* item)) \brief Perform an action on every item in the list. If one of the actions on the items fails, meaning that the \a func function returned \c false, then the processing of the list will be stopped. \param func A function that takes a \c void * argument and returns a boolean. */ /*! \fn void BList::DoForEach(bool (*func)(void* item, void* arg2), void *arg2) \brief Perform an action on every item in the list with an argument. If one of the actions on the items fails, meaning that the \a func function returned \c false, then the processing of the list will be stopped. \param func A function with the first \c void * argument being the item, and the second \c void * being the argument that you supply. It should return a boolean value on whether it succeeded or not. \param arg2 An argument to supply to \a func. */ //! @}