xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/AutoPackageAttributeDirectoryCookie.h (revision be012e21222c4d8d70082d12353acb163dc60ba8)
1 /*
2  * Copyright 2011-2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef AUTO_PACKAGE_ATTRIBUTE_DIRECTORY_COOKIE_H
6 #define AUTO_PACKAGE_ATTRIBUTE_DIRECTORY_COOKIE_H
7 
8 
9 #include "AttributeDirectoryCookie.h"
10 #include "AutoPackageAttributes.h"
11 
12 
13 /*!
14 	When used for nodes that only have the automatic package attributes, the
15 	class can be used as is. Otherwise subclassing is required.
16 	Derived classes need to override Rewind() to rewind to their first
17 	attribute, but also call the base class version. Furthermore they must
18 	implement CurrentCustomAttributeName() to return the current attribute's
19 	name and NextCustomAttributeName() to iterate to the next attribute and
20 	return its name.
21 */
22 class AutoPackageAttributeDirectoryCookie : public AttributeDirectoryCookie {
23 public:
24 								AutoPackageAttributeDirectoryCookie();
25 	virtual						~AutoPackageAttributeDirectoryCookie();
26 
27 	virtual	status_t			Read(dev_t volumeID, ino_t nodeID,
28 									struct dirent* buffer, size_t bufferSize,
29 									uint32* _count);
30 	virtual	status_t			Rewind();
31 
32 protected:
33 	virtual	String				CurrentCustomAttributeName();
34 	virtual	String				NextCustomAttributeName();
35 
36 private:
37 			uint32				fState;
38 };
39 
40 
41 #endif	// AUTO_PACKAGE_ATTRIBUTE_DIRECTORY_COOKIE_H
42