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 14 class BBitmap; 15 class BFile; 16 class BMessage; 17 class BResources; 18 19 struct 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 29 enum 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 35 enum 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 */ 47 class BAppFileInfo: public BNodeInfo { 48 public: 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 GetAppFlags(uint32 *flags) const; 62 status_t SetAppFlags(uint32 flags); 63 64 status_t GetSupportedTypes(BMessage *types) const; 65 status_t SetSupportedTypes(const BMessage *types, bool syncAll); 66 status_t SetSupportedTypes(const BMessage *types); 67 bool IsSupportedType(const char *type) const; 68 bool Supports(BMimeType *type) const; 69 70 virtual status_t GetIcon(BBitmap *icon, icon_size which) const; 71 virtual status_t SetIcon(const BBitmap *icon, icon_size which); 72 73 status_t GetVersionInfo(version_info *info, version_kind kind) const; 74 status_t SetVersionInfo(const version_info *info, version_kind kind); 75 76 status_t GetIconForType(const char *type, BBitmap *icon, 77 icon_size which) const; 78 status_t SetIconForType(const char *type, const BBitmap *icon, 79 icon_size which); 80 81 void SetInfoLocation(info_location location); 82 bool IsUsingAttributes() const; 83 bool IsUsingResources() const; 84 85 private: 86 // uncomment when needed 87 // friend status_t _update_mime_info_(const char *, int32); 88 // friend status_t _real_update_app_(BAppFileInfo *, const char *, bool); 89 // friend status_t _query_for_app_(BMimeType *, const char *, entry_ref *, 90 // version_info *); 91 // friend class BRoster; 92 93 virtual void _ReservedAppFileInfo1(); 94 virtual void _ReservedAppFileInfo2(); 95 virtual void _ReservedAppFileInfo3(); 96 97 // uncomment when needed 98 // static status_t SetSupTypesForAll(BMimeType *, const BMessage *); 99 100 BAppFileInfo &operator=(const BAppFileInfo &); 101 BAppFileInfo(const BAppFileInfo &); 102 103 // uncomment when needed 104 // status_t _SetSupportedTypes(const BMessage *types); 105 // status_t UpdateFromRsrc(); 106 // status_t RealUpdateRsrcToAttr(); 107 // status_t UpdateMetaMime(const char *path, bool force, 108 // uint32 *changesMask) const; 109 // bool IsApp(); 110 status_t GetMetaMime(BMimeType *meta) const; 111 112 status_t _ReadData(const char *name, int32 id, type_code type, 113 void *buffer, size_t bufferSize, 114 size_t &bytesRead, void **allocatedBuffer = NULL) const; 115 status_t _WriteData(const char *name, int32 id, type_code type, 116 const void *buffer, size_t bufferSize, 117 bool findID = false); 118 status_t _RemoveData(const char *name, type_code type); 119 120 BResources *fResources; 121 info_location fWhere; 122 uint32 _reserved[2]; 123 }; 124 125 #endif // _APP_FILE_INFO_H 126