xref: /haiku/src/add-ons/kernel/file_systems/btrfs/AttributeIterator.h (revision 5bfbdf0dc897f2d68cf8c64e2626eebedface691)
1956f541dSJérôme Duval /*
299768086Shyche  * Copyright 2017, Chế Vũ Gia Hy, cvghy116@gmail.com.
3956f541dSJérôme Duval  * Copyright 2011, Jérôme Duval, korli@users.berlios.de.
4956f541dSJérôme Duval  * This file may be used under the terms of the MIT License.
5956f541dSJérôme Duval  */
6956f541dSJérôme Duval #ifndef ATTRIBUTEITERATOR_H
7956f541dSJérôme Duval #define ATTRIBUTEITERATOR_H
8956f541dSJérôme Duval 
9956f541dSJérôme Duval 
10299aba38Shyche #include "BTree.h"
11956f541dSJérôme Duval #include "Inode.h"
12956f541dSJérôme Duval 
13*5bfbdf0dSbrjhaiku //! Used to traverse through attributes of a given inode
14956f541dSJérôme Duval class AttributeIterator {
15956f541dSJérôme Duval public:
16*5bfbdf0dSbrjhaiku 			//! Constructs an AttributeIterator object for Inode object *inode
17956f541dSJérôme Duval 								AttributeIterator(Inode* inode);
18956f541dSJérôme Duval 								~AttributeIterator();
19*5bfbdf0dSbrjhaiku 			//! Check if fIterator pointer is valid
20956f541dSJérôme Duval 			status_t			InitCheck();
21956f541dSJérôme Duval 
22*5bfbdf0dSbrjhaiku 			/*! Copy details of next Attribute into *name and *_nameLength
23*5bfbdf0dSbrjhaiku 			 * \param[out] name name of the current attribute
24*5bfbdf0dSbrjhaiku 			 * \param[out] _nameLength length of name
25*5bfbdf0dSbrjhaiku 			 * \return B_OK on success, B_ENTRY_NOT_FOUND otherwise
26*5bfbdf0dSbrjhaiku 			*/
27956f541dSJérôme Duval 			status_t			GetNext(char* name, size_t* _nameLength);
28*5bfbdf0dSbrjhaiku 			//! Rewind the iterator to the first attribute of the node
29956f541dSJérôme Duval 			status_t			Rewind();
30956f541dSJérôme Duval private:
31*5bfbdf0dSbrjhaiku 			//! Value of current offset from beginning of Attribute list
32956f541dSJérôme Duval 			uint64				fOffset;
33*5bfbdf0dSbrjhaiku 			//! Pointer to Inode object corresponding to AttributeIterator
34956f541dSJérôme Duval 			Inode* 				fInode;
35*5bfbdf0dSbrjhaiku 			//! Pointer to beginning of current Attribute
36956f541dSJérôme Duval 			TreeIterator*		fIterator;
37956f541dSJérôme Duval };
38956f541dSJérôme Duval 
39956f541dSJérôme Duval 
40956f541dSJérôme Duval #endif	// ATTRIBUTEITERATOR_H
41