xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/UnpackingAttributeCookie.h (revision 9f81ca838ce7b92b5689e57d3f86765db4705a7b)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef UNPACKING_ATTRIBUTE_COOKIE_H
6 #define UNPACKING_ATTRIBUTE_COOKIE_H
7 
8 
9 #include "AttributeCookie.h"
10 #include "StringKey.h"
11 
12 
13 class AttributeIndexer;
14 class Package;
15 class PackageNode;
16 class PackageNodeAttribute;
17 
18 
19 class UnpackingAttributeCookie : public AttributeCookie {
20 public:
21 								UnpackingAttributeCookie(
22 									PackageNode* packageNode,
23 									PackageNodeAttribute* attribute,
24 									int openMode);
25 	virtual						~UnpackingAttributeCookie();
26 
27 	static	status_t			Open(PackageNode* packageNode,
28 									const StringKey& name, int openMode,
29 									AttributeCookie*& _cookie);
30 
31 	virtual	status_t			ReadAttribute(off_t offset, void* buffer,
32 									size_t* bufferSize);
33 	virtual	status_t			ReadAttributeStat(struct stat* st);
34 
35 	static	status_t			ReadAttribute(PackageNode* packageNode,
36 									PackageNodeAttribute* attribute,
37 									off_t offset, void* buffer,
38 									size_t* bufferSize);
39 	static	status_t			IndexAttribute(PackageNode* packageNode,
40 									AttributeIndexer* indexer);
41 
42 private:
43 			PackageNode*		fPackageNode;
44 			Package*			fPackage;
45 			PackageNodeAttribute* fAttribute;
46 			int					fOpenMode;
47 };
48 
49 
50 #endif	// UNPACKING_ATTRIBUTE_COOKIE_H
51