1f8499e9aSAxel Dörfler/*
23b07762cSIngo Weinhold * Copyright 2002-2014, Haiku, Inc. All Rights Reserved.
3f8499e9aSAxel Dörfler * Distributed under the terms of the MIT License.
4f8499e9aSAxel Dörfler */
5d6b205f3SIngo Weinhold#ifndef _APP_FILE_INFO_H
6d6b205f3SIngo Weinhold#define _APP_FILE_INFO_H
7d6b205f3SIngo Weinhold
8f8499e9aSAxel Dörfler
9d6b205f3SIngo Weinhold#include <NodeInfo.h>
10d6b205f3SIngo Weinhold
113b07762cSIngo Weinhold
12d6b205f3SIngo Weinholdclass BBitmap;
13d6b205f3SIngo Weinholdclass BFile;
14d6b205f3SIngo Weinholdclass BMessage;
15d6b205f3SIngo Weinholdclass BResources;
16d6b205f3SIngo Weinhold
17f8499e9aSAxel Dörfler
18f8499e9aSAxel Dörflerstruct version_info {
19d6b205f3SIngo Weinhold	uint32	major;
20d6b205f3SIngo Weinhold	uint32	middle;
21d6b205f3SIngo Weinhold	uint32	minor;
22d6b205f3SIngo Weinhold	uint32	variety;
23d6b205f3SIngo Weinhold	uint32	internal;
24d6b205f3SIngo Weinhold	char	short_info[64];
25d6b205f3SIngo Weinhold	char	long_info[256];
26d6b205f3SIngo Weinhold};
27d6b205f3SIngo Weinhold
28f8499e9aSAxel Dörflerenum info_variety {
29f8499e9aSAxel Dörfler	B_DEVELOPMENT_VERSION = 0,
30f8499e9aSAxel Dörfler	B_ALPHA_VERSION,
31f8499e9aSAxel Dörfler	B_BETA_VERSION,
32f8499e9aSAxel Dörfler	B_GAMMA_VERSION,
33f8499e9aSAxel Dörfler	B_GOLDEN_MASTER_VERSION,
34f8499e9aSAxel Dörfler	B_FINAL_VERSION
35f8499e9aSAxel Dörfler};
36f8499e9aSAxel Dörfler
37d6b205f3SIngo Weinholdenum info_location {
38d6b205f3SIngo Weinhold	B_USE_ATTRIBUTES		= 0x1,
39d6b205f3SIngo Weinhold	B_USE_RESOURCES			= 0x2,
40d6b205f3SIngo Weinhold	B_USE_BOTH_LOCATIONS	= 0x3	// == B_USE_ATTRIBUTES | B_USE_RESOURCES
41d6b205f3SIngo Weinhold};
42d6b205f3SIngo Weinhold
43d6b205f3SIngo Weinholdenum version_kind {
44d6b205f3SIngo Weinhold	B_APP_VERSION_KIND,
45d6b205f3SIngo Weinhold	B_SYSTEM_VERSION_KIND
46d6b205f3SIngo Weinhold};
47d6b205f3SIngo Weinhold
48d6b205f3SIngo Weinhold
49d6b205f3SIngo Weinholdclass BAppFileInfo: public BNodeInfo {
503b07762cSIngo Weinholdpublic:
513b07762cSIngo Weinhold								BAppFileInfo();
523b07762cSIngo Weinhold								BAppFileInfo(BFile* file);
533b07762cSIngo Weinhold	virtual						~BAppFileInfo();
543b07762cSIngo Weinhold
553b07762cSIngo Weinhold			status_t			SetTo(BFile* file);
563b07762cSIngo Weinhold
573b07762cSIngo Weinhold	virtual	status_t			GetType(char* type) const;
583b07762cSIngo Weinhold	virtual	status_t			SetType(const char* type);
593b07762cSIngo Weinhold
603b07762cSIngo Weinhold			status_t			GetSignature(char* signature) const;
613b07762cSIngo Weinhold			status_t			SetSignature(const char* signature);
623b07762cSIngo Weinhold
633b07762cSIngo Weinhold			status_t			GetCatalogEntry(char* catalogEntry) const;
643b07762cSIngo Weinhold			status_t			SetCatalogEntry(const char* catalogEntry);
653b07762cSIngo Weinhold
663b07762cSIngo Weinhold			status_t			GetAppFlags(uint32* flags) const;
673b07762cSIngo Weinhold			status_t			SetAppFlags(uint32 flags);
683b07762cSIngo Weinhold			status_t			RemoveAppFlags();
693b07762cSIngo Weinhold
703b07762cSIngo Weinhold			status_t			GetSupportedTypes(BMessage* types) const;
71c41356faSIngo Weinhold			status_t			SetSupportedTypes(const BMessage* types,
72c41356faSIngo Weinhold									bool updateMimeDB, bool syncAll);
733b07762cSIngo Weinhold			status_t			SetSupportedTypes(const BMessage* types,
743b07762cSIngo Weinhold									bool syncAll);
753b07762cSIngo Weinhold			status_t			SetSupportedTypes(const BMessage* types);
763b07762cSIngo Weinhold			bool				IsSupportedType(const char* type) const;
773b07762cSIngo Weinhold			bool				Supports(BMimeType* type) const;
783b07762cSIngo Weinhold
793b07762cSIngo Weinhold	virtual	status_t			GetIcon(BBitmap* icon, icon_size which) const;
80c41356faSIngo Weinhold			status_t			SetIcon(const BBitmap* icon, icon_size which,
81c41356faSIngo Weinhold									bool updateMimeDB);
823b07762cSIngo Weinhold	virtual	status_t			SetIcon(const BBitmap* icon, icon_size which);
833b07762cSIngo Weinhold
843b07762cSIngo Weinhold			status_t			GetIcon(uint8** data, size_t* size) const;
85c41356faSIngo Weinhold			status_t			SetIcon(const uint8* data, size_t size,
86c41356faSIngo Weinhold									bool updateMimeDB);
873b07762cSIngo Weinhold			status_t			SetIcon(const uint8* data, size_t size);
883b07762cSIngo Weinhold
893b07762cSIngo Weinhold			status_t			GetVersionInfo(version_info* info,
903b07762cSIngo Weinhold									version_kind kind) const;
913b07762cSIngo Weinhold			status_t			SetVersionInfo(const version_info* info,
923b07762cSIngo Weinhold									version_kind kind);
933b07762cSIngo Weinhold
943b07762cSIngo Weinhold			status_t			GetIconForType(const char* type, BBitmap* icon,
953b07762cSIngo Weinhold									icon_size which) const;
963b07762cSIngo Weinhold			status_t			GetIconForType(const char* type, uint8** data,
973b07762cSIngo Weinhold									size_t* size) const;
98c41356faSIngo Weinhold			status_t			SetIconForType(const char* type,
99c41356faSIngo Weinhold									const BBitmap* icon, icon_size which,
100c41356faSIngo Weinhold									bool updateMimeDB);
1013b07762cSIngo Weinhold			status_t			SetIconForType(const char* type,
1023b07762cSIngo Weinhold									const BBitmap* icon, icon_size which);
103c41356faSIngo Weinhold			status_t			SetIconForType(const char* type,
104c41356faSIngo Weinhold									const uint8* data, size_t size,
105c41356faSIngo Weinhold									bool updateMimeDB);
1063b07762cSIngo Weinhold			status_t			SetIconForType(const char* type,
1073b07762cSIngo Weinhold									const uint8* data, size_t size);
1083b07762cSIngo Weinhold
1093b07762cSIngo Weinhold			void				SetInfoLocation(info_location location);
1103b07762cSIngo Weinhold			bool				IsUsingAttributes() const;
1113b07762cSIngo Weinhold			bool				IsUsingResources() const;
1123b07762cSIngo Weinhold
1133b07762cSIngo Weinholdprivate:
1143b07762cSIngo Weinhold	virtual	void				_ReservedAppFileInfo1();
1153b07762cSIngo Weinhold	virtual	void				_ReservedAppFileInfo2();
1163b07762cSIngo Weinhold	virtual	void				_ReservedAppFileInfo3();
1173b07762cSIngo Weinhold
1183b07762cSIngo Weinhold			BAppFileInfo&		operator=(const BAppFileInfo&);
1193b07762cSIngo Weinhold								BAppFileInfo(const BAppFileInfo&);
1203b07762cSIngo Weinhold
1213b07762cSIngo Weinhold			status_t			GetMetaMime(BMimeType* meta) const;
1223b07762cSIngo Weinhold
1233b07762cSIngo Weinhold			status_t			_ReadData(const char* name, int32 id,
1243b07762cSIngo Weinhold									type_code type, void* buffer,
1253b07762cSIngo Weinhold									size_t bufferSize, size_t& bytesRead,
1263b07762cSIngo Weinhold									void** allocatedBuffer = NULL) const;
1273b07762cSIngo Weinhold			status_t			_WriteData(const char* name, int32 id,
1283b07762cSIngo Weinhold									type_code type, const void* buffer,
1293b07762cSIngo Weinhold									size_t bufferSize, bool findID = false);
1303b07762cSIngo Weinhold			status_t			_RemoveData(const char* name, type_code type);
1313b07762cSIngo Weinhold
1323b07762cSIngo Weinholdprivate:
1333b07762cSIngo Weinhold			BResources*			fResources;
1343b07762cSIngo Weinhold			info_location		fWhere;
1353b07762cSIngo Weinhold			uint32				_reserved[2];
136d6b205f3SIngo Weinhold};
137d6b205f3SIngo Weinhold
1383b07762cSIngo Weinhold
139d6b205f3SIngo Weinhold#endif	// _APP_FILE_INFO_H
140