1f8499e9aSAxel Dörfler /* 23b07762cSIngo Weinhold * Copyright 2002-2014, Haiku, Inc. All Rights Reserved. 3f8499e9aSAxel Dörfler * Distributed under the terms of the MIT License. 4d6b205f3SIngo Weinhold */ 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 Weinhold class BBitmap; 13d6b205f3SIngo Weinhold class BFile; 14d6b205f3SIngo Weinhold class BMessage; 15d6b205f3SIngo Weinhold class BResources; 16d6b205f3SIngo Weinhold 17f8499e9aSAxel Dörfler 18d6b205f3SIngo Weinhold struct 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örfler enum 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 Weinhold enum 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 Weinhold enum version_kind { 44d6b205f3SIngo Weinhold B_APP_VERSION_KIND, 45d6b205f3SIngo Weinhold B_SYSTEM_VERSION_KIND 46d6b205f3SIngo Weinhold }; 47d6b205f3SIngo Weinhold 48d6b205f3SIngo Weinhold 49d6b205f3SIngo Weinhold class BAppFileInfo: public BNodeInfo { 50d6b205f3SIngo Weinhold public: 51d6b205f3SIngo Weinhold BAppFileInfo(); 52d6b205f3SIngo Weinhold BAppFileInfo(BFile* file); 53d6b205f3SIngo Weinhold virtual ~BAppFileInfo(); 54d6b205f3SIngo Weinhold 55d6b205f3SIngo Weinhold status_t SetTo(BFile* file); 56d6b205f3SIngo Weinhold 57d6b205f3SIngo Weinhold virtual status_t GetType(char* type) const; 58d6b205f3SIngo Weinhold virtual status_t SetType(const char* type); 59d6b205f3SIngo Weinhold 60d6b205f3SIngo Weinhold status_t GetSignature(char* signature) const; 61d6b205f3SIngo Weinhold status_t SetSignature(const char* signature); 6282e7ef67SJonas Sundström 6382e7ef67SJonas Sundström status_t GetCatalogEntry(char* catalogEntry) const; 6482e7ef67SJonas Sundström status_t SetCatalogEntry(const char* catalogEntry); 65d6b205f3SIngo Weinhold 66d6b205f3SIngo Weinhold status_t GetAppFlags(uint32* flags) const; 67d6b205f3SIngo Weinhold status_t SetAppFlags(uint32 flags); 6822920adfSStephan Aßmus status_t RemoveAppFlags(); 69d6b205f3SIngo Weinhold 70d6b205f3SIngo Weinhold status_t GetSupportedTypes(BMessage* types) const; 713b07762cSIngo Weinhold status_t SetSupportedTypes(const BMessage* types, 72*c41356faSIngo Weinhold bool updateMimeDB, bool syncAll); 73*c41356faSIngo Weinhold status_t SetSupportedTypes(const BMessage* types, 743b07762cSIngo Weinhold bool syncAll); 75d6b205f3SIngo Weinhold status_t SetSupportedTypes(const BMessage* types); 76d6b205f3SIngo Weinhold bool IsSupportedType(const char* type) const; 77d6b205f3SIngo Weinhold bool Supports(BMimeType* type) const; 78d6b205f3SIngo Weinhold 79d6b205f3SIngo Weinhold virtual status_t GetIcon(BBitmap* icon, icon_size which) const; 80*c41356faSIngo Weinhold status_t SetIcon(const BBitmap* icon, icon_size which, 81*c41356faSIngo Weinhold bool updateMimeDB); 82d6b205f3SIngo Weinhold virtual status_t SetIcon(const BBitmap* icon, icon_size which); 83d6b205f3SIngo Weinhold 847fb6186fSStephan Aßmus status_t GetIcon(uint8** data, size_t* size) const; 85*c41356faSIngo Weinhold status_t SetIcon(const uint8* data, size_t size, 86*c41356faSIngo Weinhold bool updateMimeDB); 877fb6186fSStephan Aßmus status_t SetIcon(const uint8* data, size_t size); 887fb6186fSStephan Aßmus 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); 93d6b205f3SIngo Weinhold 94d6b205f3SIngo Weinhold status_t GetIconForType(const char* type, BBitmap* icon, 95d6b205f3SIngo Weinhold icon_size which) const; 967fb6186fSStephan Aßmus status_t GetIconForType(const char* type, uint8** data, 977fb6186fSStephan Aßmus size_t* size) const; 983b07762cSIngo Weinhold status_t SetIconForType(const char* type, 99*c41356faSIngo Weinhold const BBitmap* icon, icon_size which, 100*c41356faSIngo Weinhold bool updateMimeDB); 101*c41356faSIngo Weinhold status_t SetIconForType(const char* type, 1023b07762cSIngo Weinhold const BBitmap* icon, icon_size which); 1033b07762cSIngo Weinhold status_t SetIconForType(const char* type, 104*c41356faSIngo Weinhold const uint8* data, size_t size, 105*c41356faSIngo Weinhold bool updateMimeDB); 106*c41356faSIngo Weinhold status_t SetIconForType(const char* type, 1073b07762cSIngo Weinhold const uint8* data, size_t size); 108d6b205f3SIngo Weinhold 109d6b205f3SIngo Weinhold void SetInfoLocation(info_location location); 110d6b205f3SIngo Weinhold bool IsUsingAttributes() const; 111d6b205f3SIngo Weinhold bool IsUsingResources() const; 112d6b205f3SIngo Weinhold 113d6b205f3SIngo Weinhold private: 114d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo1(); 115d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo2(); 116d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo3(); 117d6b205f3SIngo Weinhold 118d6b205f3SIngo Weinhold BAppFileInfo& operator=(const BAppFileInfo&); 119d6b205f3SIngo Weinhold BAppFileInfo(const BAppFileInfo&); 120d6b205f3SIngo Weinhold 12198da112cSIngo Weinhold status_t GetMetaMime(BMimeType* meta) const; 12298da112cSIngo 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); 13098da112cSIngo Weinhold status_t _RemoveData(const char* name, type_code type); 131d6b205f3SIngo Weinhold 1323b07762cSIngo Weinhold private: 133d6b205f3SIngo Weinhold BResources* fResources; 134d6b205f3SIngo Weinhold info_location fWhere; 135d6b205f3SIngo Weinhold uint32 _reserved[2]; 136d6b205f3SIngo Weinhold }; 137d6b205f3SIngo Weinhold 1383b07762cSIngo Weinhold 139d6b205f3SIngo Weinhold #endif // _APP_FILE_INFO_H 140