1d6b205f3SIngo Weinhold //---------------------------------------------------------------------- 2d6b205f3SIngo Weinhold // This software is part of the OpenBeOS distribution and is covered 3d6b205f3SIngo Weinhold // by the OpenBeOS license. 4d6b205f3SIngo Weinhold //--------------------------------------------------------------------- 5d6b205f3SIngo Weinhold /*! 6d6b205f3SIngo Weinhold \file AppFileInfo.h 7d6b205f3SIngo Weinhold BAppFileInfo and related structures' interface declarations. 8d6b205f3SIngo Weinhold */ 9d6b205f3SIngo Weinhold #ifndef _APP_FILE_INFO_H 10d6b205f3SIngo Weinhold #define _APP_FILE_INFO_H 11d6b205f3SIngo Weinhold 12d6b205f3SIngo Weinhold #include <NodeInfo.h> 13d6b205f3SIngo Weinhold 14d6b205f3SIngo Weinhold class BBitmap; 15d6b205f3SIngo Weinhold class BFile; 16d6b205f3SIngo Weinhold class BMessage; 17d6b205f3SIngo Weinhold class BResources; 18d6b205f3SIngo Weinhold 19d6b205f3SIngo Weinhold struct version_info { 20d6b205f3SIngo Weinhold uint32 major; 21d6b205f3SIngo Weinhold uint32 middle; 22d6b205f3SIngo Weinhold uint32 minor; 23d6b205f3SIngo Weinhold uint32 variety; 24d6b205f3SIngo Weinhold uint32 internal; 25d6b205f3SIngo Weinhold char short_info[64]; 26d6b205f3SIngo Weinhold char long_info[256]; 27d6b205f3SIngo Weinhold }; 28d6b205f3SIngo Weinhold 29d6b205f3SIngo Weinhold enum info_location { 30d6b205f3SIngo Weinhold B_USE_ATTRIBUTES = 0x1, 31d6b205f3SIngo Weinhold B_USE_RESOURCES = 0x2, 32d6b205f3SIngo Weinhold B_USE_BOTH_LOCATIONS = 0x3 // == B_USE_ATTRIBUTES | B_USE_RESOURCES 33d6b205f3SIngo Weinhold }; 34d6b205f3SIngo Weinhold 35d6b205f3SIngo Weinhold enum version_kind { 36d6b205f3SIngo Weinhold B_APP_VERSION_KIND, 37d6b205f3SIngo Weinhold B_SYSTEM_VERSION_KIND 38d6b205f3SIngo Weinhold }; 39d6b205f3SIngo Weinhold 40d6b205f3SIngo Weinhold /*! \brief Executable meta information handling. 41d6b205f3SIngo Weinhold The BAppFileInfo class provides access to meta data that can be associated 42d6b205f3SIngo Weinhold with executables, libraries and add-ons. 43d6b205f3SIngo Weinhold 44d6b205f3SIngo Weinhold \author <a href='bonefish@users.sf.net'>Ingo Weinhold</a> 45d6b205f3SIngo Weinhold \version 0.0.0 46d6b205f3SIngo Weinhold */ 47d6b205f3SIngo Weinhold class BAppFileInfo: public BNodeInfo { 48d6b205f3SIngo Weinhold public: 49d6b205f3SIngo Weinhold BAppFileInfo(); 50d6b205f3SIngo Weinhold BAppFileInfo(BFile *file); 51d6b205f3SIngo Weinhold virtual ~BAppFileInfo(); 52d6b205f3SIngo Weinhold 53d6b205f3SIngo Weinhold status_t SetTo(BFile *file); 54d6b205f3SIngo Weinhold 55d6b205f3SIngo Weinhold virtual status_t GetType(char *type) const; 56d6b205f3SIngo Weinhold virtual status_t SetType(const char *type); 57d6b205f3SIngo Weinhold 58d6b205f3SIngo Weinhold status_t GetSignature(char *signature) const; 59d6b205f3SIngo Weinhold status_t SetSignature(const char *signature); 60d6b205f3SIngo Weinhold 61d6b205f3SIngo Weinhold status_t GetAppFlags(uint32 *flags) const; 62d6b205f3SIngo Weinhold status_t SetAppFlags(uint32 flags); 63d6b205f3SIngo Weinhold 64d6b205f3SIngo Weinhold status_t GetSupportedTypes(BMessage *types) const; 65d6b205f3SIngo Weinhold status_t SetSupportedTypes(const BMessage *types, bool syncAll); 66d6b205f3SIngo Weinhold status_t SetSupportedTypes(const BMessage *types); 67d6b205f3SIngo Weinhold bool IsSupportedType(const char *type) const; 68d6b205f3SIngo Weinhold bool Supports(BMimeType *type) const; 69d6b205f3SIngo Weinhold 70d6b205f3SIngo Weinhold virtual status_t GetIcon(BBitmap *icon, icon_size which) const; 71d6b205f3SIngo Weinhold virtual status_t SetIcon(const BBitmap *icon, icon_size which); 72d6b205f3SIngo Weinhold 73d6b205f3SIngo Weinhold status_t GetVersionInfo(version_info *info, version_kind kind) const; 74d6b205f3SIngo Weinhold status_t SetVersionInfo(const version_info *info, version_kind kind); 75d6b205f3SIngo Weinhold 76d6b205f3SIngo Weinhold status_t GetIconForType(const char *type, BBitmap *icon, 77d6b205f3SIngo Weinhold icon_size which) const; 78d6b205f3SIngo Weinhold status_t SetIconForType(const char *type, const BBitmap *icon, 79d6b205f3SIngo Weinhold icon_size which); 80d6b205f3SIngo Weinhold 81d6b205f3SIngo Weinhold void SetInfoLocation(info_location location); 82d6b205f3SIngo Weinhold bool IsUsingAttributes() const; 83d6b205f3SIngo Weinhold bool IsUsingResources() const; 84d6b205f3SIngo Weinhold 85d6b205f3SIngo Weinhold private: 86d6b205f3SIngo Weinhold // uncomment when needed 87d6b205f3SIngo Weinhold // friend status_t _update_mime_info_(const char *, int32); 88d6b205f3SIngo Weinhold // friend status_t _real_update_app_(BAppFileInfo *, const char *, bool); 89d6b205f3SIngo Weinhold // friend status_t _query_for_app_(BMimeType *, const char *, entry_ref *, 90d6b205f3SIngo Weinhold // version_info *); 91d6b205f3SIngo Weinhold // friend class BRoster; 92d6b205f3SIngo Weinhold 93d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo1(); 94d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo2(); 95d6b205f3SIngo Weinhold virtual void _ReservedAppFileInfo3(); 96d6b205f3SIngo Weinhold 97d6b205f3SIngo Weinhold // uncomment when needed 98d6b205f3SIngo Weinhold // static status_t SetSupTypesForAll(BMimeType *, const BMessage *); 99d6b205f3SIngo Weinhold 100d6b205f3SIngo Weinhold BAppFileInfo &operator=(const BAppFileInfo &); 101d6b205f3SIngo Weinhold BAppFileInfo(const BAppFileInfo &); 102d6b205f3SIngo Weinhold 103d6b205f3SIngo Weinhold // uncomment when needed 104d6b205f3SIngo Weinhold // status_t _SetSupportedTypes(const BMessage *types); 105d6b205f3SIngo Weinhold // status_t UpdateFromRsrc(); 106d6b205f3SIngo Weinhold // status_t RealUpdateRsrcToAttr(); 107d6b205f3SIngo Weinhold // status_t UpdateMetaMime(const char *path, bool force, 108d6b205f3SIngo Weinhold // uint32 *changesMask) const; 109d6b205f3SIngo Weinhold // bool IsApp(); 110*98da112cSIngo Weinhold status_t GetMetaMime(BMimeType *meta) const; 111*98da112cSIngo Weinhold 112*98da112cSIngo Weinhold status_t _ReadData(const char *name, int32 id, type_code type, 113*98da112cSIngo Weinhold void *buffer, size_t bufferSize, 114*98da112cSIngo Weinhold size_t &bytesRead, void **allocatedBuffer = NULL) const; 115*98da112cSIngo Weinhold status_t _WriteData(const char *name, int32 id, type_code type, 116*98da112cSIngo Weinhold const void *buffer, size_t bufferSize, 117*98da112cSIngo Weinhold bool findID = false); 118*98da112cSIngo Weinhold status_t _RemoveData(const char *name, type_code type); 119d6b205f3SIngo Weinhold 120d6b205f3SIngo Weinhold BResources *fResources; 121d6b205f3SIngo Weinhold info_location fWhere; 122d6b205f3SIngo Weinhold uint32 _reserved[2]; 123d6b205f3SIngo Weinhold }; 124d6b205f3SIngo Weinhold 125d6b205f3SIngo Weinhold #endif // _APP_FILE_INFO_H 126