1f8499e9aSAxel Dörfler /* 2f8499e9aSAxel Dörfler * Copyright 2002-2006, 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 11d6b205f3SIngo Weinhold class BBitmap; 12d6b205f3SIngo Weinhold class BFile; 13d6b205f3SIngo Weinhold class BMessage; 14d6b205f3SIngo Weinhold class BResources; 15d6b205f3SIngo Weinhold 16f8499e9aSAxel Dörfler 17d6b205f3SIngo Weinhold struct version_info { 18d6b205f3SIngo Weinhold uint32 major; 19d6b205f3SIngo Weinhold uint32 middle; 20d6b205f3SIngo Weinhold uint32 minor; 21d6b205f3SIngo Weinhold uint32 variety; 22d6b205f3SIngo Weinhold uint32 internal; 23d6b205f3SIngo Weinhold char short_info[64]; 24d6b205f3SIngo Weinhold char long_info[256]; 25d6b205f3SIngo Weinhold }; 26d6b205f3SIngo Weinhold 27f8499e9aSAxel Dörfler enum info_variety { 28f8499e9aSAxel Dörfler B_DEVELOPMENT_VERSION = 0, 29f8499e9aSAxel Dörfler B_ALPHA_VERSION, 30f8499e9aSAxel Dörfler B_BETA_VERSION, 31f8499e9aSAxel Dörfler B_GAMMA_VERSION, 32f8499e9aSAxel Dörfler B_GOLDEN_MASTER_VERSION, 33f8499e9aSAxel Dörfler B_FINAL_VERSION 34f8499e9aSAxel Dörfler }; 35f8499e9aSAxel Dörfler 36d6b205f3SIngo Weinhold enum info_location { 37d6b205f3SIngo Weinhold B_USE_ATTRIBUTES = 0x1, 38d6b205f3SIngo Weinhold B_USE_RESOURCES = 0x2, 39d6b205f3SIngo Weinhold B_USE_BOTH_LOCATIONS = 0x3 // == B_USE_ATTRIBUTES | B_USE_RESOURCES 40d6b205f3SIngo Weinhold }; 41d6b205f3SIngo Weinhold 42d6b205f3SIngo Weinhold enum version_kind { 43d6b205f3SIngo Weinhold B_APP_VERSION_KIND, 44d6b205f3SIngo Weinhold B_SYSTEM_VERSION_KIND 45d6b205f3SIngo Weinhold }; 46d6b205f3SIngo Weinhold 47d6b205f3SIngo Weinhold /*! \brief Executable meta information handling. 48d6b205f3SIngo Weinhold The BAppFileInfo class provides access to meta data that can be associated 49d6b205f3SIngo Weinhold with executables, libraries and add-ons. 50d6b205f3SIngo Weinhold 51d6b205f3SIngo Weinhold \author <a href='bonefish@users.sf.net'>Ingo Weinhold</a> 52d6b205f3SIngo Weinhold \version 0.0.0 53d6b205f3SIngo Weinhold */ 54d6b205f3SIngo Weinhold class BAppFileInfo: public BNodeInfo { 55d6b205f3SIngo Weinhold public: 56d6b205f3SIngo Weinhold BAppFileInfo(); 57d6b205f3SIngo Weinhold BAppFileInfo(BFile *file); 58d6b205f3SIngo Weinhold virtual ~BAppFileInfo(); 59d6b205f3SIngo Weinhold 60d6b205f3SIngo Weinhold status_t SetTo(BFile *file); 61d6b205f3SIngo Weinhold 62d6b205f3SIngo Weinhold virtual status_t GetType(char *type) const; 63d6b205f3SIngo Weinhold virtual status_t SetType(const char *type); 64d6b205f3SIngo Weinhold 65d6b205f3SIngo Weinhold status_t GetSignature(char *signature) const; 66d6b205f3SIngo Weinhold status_t SetSignature(const char *signature); 67*82e7ef67SJonas Sundström 68*82e7ef67SJonas Sundström status_t GetCatalogEntry(char *catalogEntry) const; 69*82e7ef67SJonas Sundström status_t SetCatalogEntry(const char *catalogEntry); 70d6b205f3SIngo Weinhold 71d6b205f3SIngo Weinhold status_t GetAppFlags(uint32 *flags) const; 72d6b205f3SIngo Weinhold status_t SetAppFlags(uint32 flags); 7322920adfSStephan Aßmus status_t RemoveAppFlags(); 74d6b205f3SIngo Weinhold 75d6b205f3SIngo Weinhold status_t GetSupportedTypes(BMessage *types) const; 76d6b205f3SIngo Weinhold status_t SetSupportedTypes(const BMessage *types, bool syncAll); 77d6b205f3SIngo Weinhold status_t SetSupportedTypes(const BMessage *types); 78d6b205f3SIngo Weinhold bool IsSupportedType(const char *type) const; 79d6b205f3SIngo Weinhold bool Supports(BMimeType *type) const; 80d6b205f3SIngo Weinhold 81d6b205f3SIngo Weinhold virtual status_t GetIcon(BBitmap *icon, icon_size which) const; 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; 857fb6186fSStephan Aßmus status_t SetIcon(const uint8* data, size_t size); 867fb6186fSStephan Aßmus 87d6b205f3SIngo Weinhold status_t GetVersionInfo(version_info *info, version_kind kind) const; 88d6b205f3SIngo Weinhold status_t SetVersionInfo(const version_info *info, version_kind kind); 89d6b205f3SIngo Weinhold 90d6b205f3SIngo Weinhold status_t GetIconForType(const char *type, BBitmap *icon, 91d6b205f3SIngo Weinhold icon_size which) const; 927fb6186fSStephan Aßmus status_t GetIconForType(const char *type, uint8** data, 937fb6186fSStephan Aßmus size_t* size) const; 94d6b205f3SIngo Weinhold status_t SetIconForType(const char *type, const BBitmap *icon, 95d6b205f3SIngo Weinhold icon_size which); 967fb6186fSStephan Aßmus status_t SetIconForType(const char *type, const uint8* data, 977fb6186fSStephan Aßmus size_t size); 98d6b205f3SIngo Weinhold 99d6b205f3SIngo Weinhold void SetInfoLocation(info_location location); 100d6b205f3SIngo Weinhold bool IsUsingAttributes() const; 101d6b205f3SIngo Weinhold bool IsUsingResources() const; 102d6b205f3SIngo Weinhold 103d6b205f3SIngo Weinhold private: 104d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo1(); 105d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo2(); 106d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo3(); 107d6b205f3SIngo Weinhold 108d6b205f3SIngo Weinhold BAppFileInfo &operator=(const BAppFileInfo &); 109d6b205f3SIngo Weinhold BAppFileInfo(const BAppFileInfo &); 110d6b205f3SIngo Weinhold 11198da112cSIngo Weinhold status_t GetMetaMime(BMimeType *meta) const; 11298da112cSIngo Weinhold 11398da112cSIngo Weinhold status_t _ReadData(const char *name, int32 id, type_code type, 11498da112cSIngo Weinhold void *buffer, size_t bufferSize, 11598da112cSIngo Weinhold size_t &bytesRead, void **allocatedBuffer = NULL) const; 11698da112cSIngo Weinhold status_t _WriteData(const char *name, int32 id, type_code type, 11798da112cSIngo Weinhold const void *buffer, size_t bufferSize, 11898da112cSIngo Weinhold bool findID = false); 11998da112cSIngo Weinhold status_t _RemoveData(const char *name, type_code type); 120d6b205f3SIngo Weinhold 121d6b205f3SIngo Weinhold BResources *fResources; 122d6b205f3SIngo Weinhold info_location fWhere; 123d6b205f3SIngo Weinhold uint32 _reserved[2]; 124d6b205f3SIngo Weinhold }; 125d6b205f3SIngo Weinhold 126d6b205f3SIngo Weinhold #endif // _APP_FILE_INFO_H 127