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
11
12class AttributeIndexer;
13class Package;
14class PackageNode;
15class PackageNodeAttribute;
16
17
18class UnpackingAttributeCookie : public AttributeCookie {
19public:
20								UnpackingAttributeCookie(
21									PackageNode* packageNode,
22									PackageNodeAttribute* attribute,
23									int openMode);
24	virtual						~UnpackingAttributeCookie();
25
26	static	status_t			Open(PackageNode* packageNode, const char* name,
27									int openMode, AttributeCookie*& _cookie);
28
29	virtual	status_t			ReadAttribute(off_t offset, void* buffer,
30									size_t* bufferSize);
31	virtual	status_t			ReadAttributeStat(struct stat* st);
32
33	static	status_t			ReadAttribute(PackageNode* packageNode,
34									PackageNodeAttribute* attribute,
35									off_t offset, void* buffer,
36									size_t* bufferSize);
37	static	status_t			IndexAttribute(PackageNode* packageNode,
38									AttributeIndexer* indexer);
39
40private:
41			PackageNode*		fPackageNode;
42			Package*			fPackage;
43			PackageNodeAttribute* fAttribute;
44			int					fOpenMode;
45};
46
47
48#endif	// UNPACKING_ATTRIBUTE_COOKIE_H
49