xref: /haiku/src/add-ons/kernel/file_systems/packagefs/nodes/AutoPackageAttributes.h (revision f8da8f3477d3c18142e59d17d05a545982faa5a8)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef AUTO_PACKAGE_ATTRIBUTES_H
6 #define AUTO_PACKAGE_ATTRIBUTES_H
7 
8 
9 #include <SupportDefs.h>
10 
11 #include "StringKey.h"
12 
13 
14 class AttributeCookie;
15 class Package;
16 
17 
18 enum AutoPackageAttribute {
19 	AUTO_PACKAGE_ATTRIBUTE_ENUM_FIRST,
20 	AUTO_PACKAGE_ATTRIBUTE_PACKAGE = AUTO_PACKAGE_ATTRIBUTE_ENUM_FIRST,
21 	AUTO_PACKAGE_ATTRIBUTE_PACKAGE_FILE,
22 
23 	AUTO_PACKAGE_ATTRIBUTE_ENUM_COUNT
24 };
25 
26 
27 struct AutoPackageAttributes {
28 	static	bool				AttributeForName(const StringKey& name,
29 									AutoPackageAttribute& _attribute);
30 	static	const String&		NameForAttribute(
31 									AutoPackageAttribute attribute);
32 	static	const void*			GetAttributeValue(const Package* package,
33 									AutoPackageAttribute attribute,
34 									off_t& _size, uint32& _type);
35 
36 	static	status_t			OpenCookie(Package* package,
37 									const StringKey& name, int openMode,
38 									AttributeCookie*& _cookie);
39 };
40 
41 
42 #endif	// AUTO_PACKAGE_ATTRIBUTES_H
43