1 /* 2 * Copyright 2017, Chế Vũ Gia Hy, cvghy116@gmail.com. 3 * Copyright 2011, Jérôme Duval, korli@users.berlios.de. 4 * This file may be used under the terms of the MIT License. 5 */ 6 #ifndef ATTRIBUTEITERATOR_H 7 #define ATTRIBUTEITERATOR_H 8 9 10 #include "BTree.h" 11 #include "Inode.h" 12 13 //! Used to traverse through attributes of a given inode 14 class AttributeIterator { 15 public: 16 //! Constructs an AttributeIterator object for Inode object *inode 17 AttributeIterator(Inode* inode); 18 ~AttributeIterator(); 19 //! Check if fIterator pointer is valid 20 status_t InitCheck(); 21 22 /*! Copy details of next Attribute into *name and *_nameLength 23 * \param[out] name name of the current attribute 24 * \param[out] _nameLength length of name 25 * \return B_OK on success, B_ENTRY_NOT_FOUND otherwise 26 */ 27 status_t GetNext(char* name, size_t* _nameLength); 28 //! Rewind the iterator to the first attribute of the node 29 status_t Rewind(); 30 private: 31 //! Value of current offset from beginning of Attribute list 32 uint64 fOffset; 33 //! Pointer to Inode object corresponding to AttributeIterator 34 Inode* fInode; 35 //! Pointer to beginning of current Attribute 36 TreeIterator* fIterator; 37 }; 38 39 40 #endif // ATTRIBUTEITERATOR_H 41