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