1*a33f8fbdSAdrien Destugues/* 2*a33f8fbdSAdrien Destugues * Copyright 2011, Haiku inc. 3*a33f8fbdSAdrien Destugues * Distributed under the terms of the MIT Licence. 4*a33f8fbdSAdrien Destugues * 5*a33f8fbdSAdrien Destugues * Documentation by: 6*a33f8fbdSAdrien Destugues * John Scipione <jscipione@gmail.com> 7*a33f8fbdSAdrien Destugues * Ingo Weinhold <bonefish@users.sf.net> 8*a33f8fbdSAdrien Destugues * Corresponds to: 9*a33f8fbdSAdrien Destugues * /trunk/headers/os/storage/AppFileInfo.h rev 42274 10*a33f8fbdSAdrien Destugues * /trunk/src/kits/storage/AppFileInfo.cpp rev 42274 11*a33f8fbdSAdrien Destugues */ 12*a33f8fbdSAdrien Destugues 13*a33f8fbdSAdrien Destugues 14*a33f8fbdSAdrien Destugues/*! 15*a33f8fbdSAdrien Destugues \file AppFileInfo.h 16*a33f8fbdSAdrien Destugues \brief Provides the BAppFileInfo class. 17*a33f8fbdSAdrien Destugues*/ 18*a33f8fbdSAdrien Destugues 19*a33f8fbdSAdrien Destugues 20*a33f8fbdSAdrien Destugues/*! 21*a33f8fbdSAdrien Destugues \class BAppFileInfo 22*a33f8fbdSAdrien Destugues \ingroup storage 23*a33f8fbdSAdrien Destugues \brief Provides access to the metadata associated with executables, 24*a33f8fbdSAdrien Destugues libraries and add-ons. 25*a33f8fbdSAdrien Destugues 26*a33f8fbdSAdrien Destugues The BAppFileInfo class allows for information about an executable or 27*a33f8fbdSAdrien Destugues add-on to be accessed or set. Information about an executable that can be 28*a33f8fbdSAdrien Destugues accessed include the signature, catalog entry, supported MIME types, 29*a33f8fbdSAdrien Destugues application flags, icon(s), and version info. 30*a33f8fbdSAdrien Destugues 31*a33f8fbdSAdrien Destugues You should initialize the BAppFileInfo with a BFile object that represents 32*a33f8fbdSAdrien Destugues the executable or add-on that you want to access. If you only want to read 33*a33f8fbdSAdrien Destugues metadata from the file you do not have to open it for reading. However, if 34*a33f8fbdSAdrien Destugues you also want to write metadata then you should open the BFile for writing. 35*a33f8fbdSAdrien Destugues 36*a33f8fbdSAdrien Destugues To associate a BFile with a BAppFileInfo object you can either pass the 37*a33f8fbdSAdrien Destugues BFile object into the constructor or you can use the empty constructor and 38*a33f8fbdSAdrien Destugues then use the SetTo() method to set the BFile to the BAppFileInfo object. 39*a33f8fbdSAdrien Destugues 40*a33f8fbdSAdrien Destugues When accessing information from a BFileInfo object it will first look in the 41*a33f8fbdSAdrien Destugues attributes of the BFile. If the information is not found then the BFileInfo 42*a33f8fbdSAdrien Destugues object will next look at the resource of the BFile. You can tell the 43*a33f8fbdSAdrien Destugues BFileInfo object to look only in the attributes or resources with the 44*a33f8fbdSAdrien Destugues SetInfoLocation() method. 45*a33f8fbdSAdrien Destugues*/ 46*a33f8fbdSAdrien Destugues 47*a33f8fbdSAdrien Destugues 48*a33f8fbdSAdrien Destugues/*! 49*a33f8fbdSAdrien Destugues \fn BAppFileInfo::BAppFileInfo() 50*a33f8fbdSAdrien Destugues \brief Creates an uninitialized BAppFileInfo object. 51*a33f8fbdSAdrien Destugues*/ 52*a33f8fbdSAdrien Destugues 53*a33f8fbdSAdrien Destugues 54*a33f8fbdSAdrien Destugues/*! 55*a33f8fbdSAdrien Destugues \fn BAppFileInfo::BAppFileInfo(BFile* file) 56*a33f8fbdSAdrien Destugues \brief Creates an BAppFileInfo object and initializes it to the supplied 57*a33f8fbdSAdrien Destugues file. 58*a33f8fbdSAdrien Destugues 59*a33f8fbdSAdrien Destugues The caller retains ownership of the supplied BFile object. It must not 60*a33f8fbdSAdrien Destugues be deleted during the life time of the BAppFileInfo. It is not deleted 61*a33f8fbdSAdrien Destugues when the BAppFileInfo is destroyed. 62*a33f8fbdSAdrien Destugues 63*a33f8fbdSAdrien Destugues \param file The BFile object that the BAppFileInfo object shall be 64*a33f8fbdSAdrien Destugues initialized to. 65*a33f8fbdSAdrien Destugues*/ 66*a33f8fbdSAdrien Destugues 67*a33f8fbdSAdrien Destugues 68*a33f8fbdSAdrien Destugues/*! 69*a33f8fbdSAdrien Destugues \fn BAppFileInfo::~BAppFileInfo() 70*a33f8fbdSAdrien Destugues \brief Frees all resources associated with this object. 71*a33f8fbdSAdrien Destugues 72*a33f8fbdSAdrien Destugues The supplied BFile object is not deleted if one is specified. 73*a33f8fbdSAdrien Destugues*/ 74*a33f8fbdSAdrien Destugues 75*a33f8fbdSAdrien Destugues 76*a33f8fbdSAdrien Destugues/*! 77*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetTo(BFile *file) 78*a33f8fbdSAdrien Destugues \brief Initializes the BAppFileInfo to the supplied file. 79*a33f8fbdSAdrien Destugues 80*a33f8fbdSAdrien Destugues The caller retains ownership of the supplied BFile object. It must not 81*a33f8fbdSAdrien Destugues be deleted during the life time of the BAppFileInfo. The BFile object 82*a33f8fbdSAdrien Destugues is not deleted when the BAppFileInfo is destroyed. 83*a33f8fbdSAdrien Destugues 84*a33f8fbdSAdrien Destugues \param file The BFile object that the BAppFileInfo object shall be 85*a33f8fbdSAdrien Destugues initialized to. 86*a33f8fbdSAdrien Destugues 87*a33f8fbdSAdrien Destugues \returns an status code. 88*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 89*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a file or \a file is not properly initialized. 90*a33f8fbdSAdrien Destugues*/ 91*a33f8fbdSAdrien Destugues 92*a33f8fbdSAdrien Destugues 93*a33f8fbdSAdrien Destugues/*! 94*a33f8fbdSAdrien Destugues \name MIME Type 95*a33f8fbdSAdrien Destugues*/ 96*a33f8fbdSAdrien Destugues 97*a33f8fbdSAdrien Destugues 98*a33f8fbdSAdrien Destugues//! @{ 99*a33f8fbdSAdrien Destugues 100*a33f8fbdSAdrien Destugues 101*a33f8fbdSAdrien Destugues/*! 102*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetType(char *type) const 103*a33f8fbdSAdrien Destugues \brief Gets the MIME type of the associated file. 104*a33f8fbdSAdrien Destugues 105*a33f8fbdSAdrien Destugues \param type A pointer to a pre-allocated character buffer of size 106*a33f8fbdSAdrien Destugues \c B_MIME_TYPE_LENGTH or larger into which the MIME type of the 107*a33f8fbdSAdrien Destugues file will be written. 108*a33f8fbdSAdrien Destugues 109*a33f8fbdSAdrien Destugues \returns A status code. 110*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 111*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 112*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a type or the type string stored in the 113*a33f8fbdSAdrien Destugues attribute/resources is longer than \c B_MIME_TYPE_LENGTH. 114*a33f8fbdSAdrien Destugues \retval B_BAD_TYPE The attribute/resources the type string is stored in 115*a33f8fbdSAdrien Destugues has the wrong type. 116*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND No type is set on the file. 117*a33f8fbdSAdrien Destugues*/ 118*a33f8fbdSAdrien Destugues 119*a33f8fbdSAdrien Destugues 120*a33f8fbdSAdrien Destugues/*! 121*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetType(const char* type) 122*a33f8fbdSAdrien Destugues \brief Sets the MIME type of the associated file. 123*a33f8fbdSAdrien Destugues 124*a33f8fbdSAdrien Destugues If \a type is \c NULL if the file's MIME type is unset. 125*a33f8fbdSAdrien Destugues 126*a33f8fbdSAdrien Destugues \param type The MIME type to be assigned to the file. It must not be 127*a33f8fbdSAdrien Destugues longer than \c B_MIME_TYPE_LENGTH (including the terminating null). 128*a33f8fbdSAdrien Destugues The MIME type may be \c NULL. 129*a33f8fbdSAdrien Destugues 130*a33f8fbdSAdrien Destugues \returns a status code. 131*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 132*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 133*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \a type is longer than \c B_MIME_TYPE_LENGTH. 134*a33f8fbdSAdrien Destugues*/ 135*a33f8fbdSAdrien Destugues 136*a33f8fbdSAdrien Destugues 137*a33f8fbdSAdrien Destugues//! @} 138*a33f8fbdSAdrien Destugues 139*a33f8fbdSAdrien Destugues 140*a33f8fbdSAdrien Destugues/*! 141*a33f8fbdSAdrien Destugues \name Signature 142*a33f8fbdSAdrien Destugues*/ 143*a33f8fbdSAdrien Destugues 144*a33f8fbdSAdrien Destugues 145*a33f8fbdSAdrien Destugues//! @{ 146*a33f8fbdSAdrien Destugues 147*a33f8fbdSAdrien Destugues 148*a33f8fbdSAdrien Destugues/*! 149*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetSignature(char* signature) const 150*a33f8fbdSAdrien Destugues \brief Gets the application signature of the associated file. 151*a33f8fbdSAdrien Destugues 152*a33f8fbdSAdrien Destugues \param signature A pointer to a pre-allocated character buffer of size 153*a33f8fbdSAdrien Destugues \c B_MIME_TYPE_LENGTH or larger into which the application 154*a33f8fbdSAdrien Destugues signature of the file will be written. 155*a33f8fbdSAdrien Destugues 156*a33f8fbdSAdrien Destugues \returns a status code. 157*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 158*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 159*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a signature or the signature stored in the 160*a33f8fbdSAdrien Destugues attribute/resources is longer than \c B_MIME_TYPE_LENGTH. 161*a33f8fbdSAdrien Destugues \retval B_BAD_TYPE The attribute/resources the signature is stored in have 162*a33f8fbdSAdrien Destugues the wrong type. 163*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND No signature is set on the file. 164*a33f8fbdSAdrien Destugues*/ 165*a33f8fbdSAdrien Destugues 166*a33f8fbdSAdrien Destugues 167*a33f8fbdSAdrien Destugues/*! 168*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetSignature(const char* signature) 169*a33f8fbdSAdrien Destugues \brief Sets the application signature of the associated file. 170*a33f8fbdSAdrien Destugues 171*a33f8fbdSAdrien Destugues If \a signature is \c NULL the file's application signature is unset. 172*a33f8fbdSAdrien Destugues 173*a33f8fbdSAdrien Destugues \param signature The application signature to be assigned to the file. 174*a33f8fbdSAdrien Destugues Must not be longer than \c B_MIME_TYPE_LENGTH (including the 175*a33f8fbdSAdrien Destugues terminating \c NUL). The \a signature may be \c NULL. 176*a33f8fbdSAdrien Destugues 177*a33f8fbdSAdrien Destugues \returns a status code. 178*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 179*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 180*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \a signature is longer than \c B_MIME_TYPE_LENGTH. 181*a33f8fbdSAdrien Destugues*/ 182*a33f8fbdSAdrien Destugues 183*a33f8fbdSAdrien Destugues 184*a33f8fbdSAdrien Destugues//! @} 185*a33f8fbdSAdrien Destugues 186*a33f8fbdSAdrien Destugues 187*a33f8fbdSAdrien Destugues/*! 188*a33f8fbdSAdrien Destugues \name Catalog Entry 189*a33f8fbdSAdrien Destugues*/ 190*a33f8fbdSAdrien Destugues 191*a33f8fbdSAdrien Destugues 192*a33f8fbdSAdrien Destugues//! @{ 193*a33f8fbdSAdrien Destugues 194*a33f8fbdSAdrien Destugues 195*a33f8fbdSAdrien Destugues/*! 196*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetCatalogEntry(char *catalogEntry) const 197*a33f8fbdSAdrien Destugues \brief Gets the catalog entry of the associated file used for localization. 198*a33f8fbdSAdrien Destugues 199*a33f8fbdSAdrien Destugues \param catalogEntry A pointer to a pre-allocated character buffer of size 200*a33f8fbdSAdrien Destugues \c B_MIME_TYPE_LENGTH * 3 or larger into which the catalog entry 201*a33f8fbdSAdrien Destugues of the file will be written. 202*a33f8fbdSAdrien Destugues 203*a33f8fbdSAdrien Destugues \returns a status code. 204*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 205*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 206*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a catalogEntry or the entry stored in the 207*a33f8fbdSAdrien Destugues attribute/resources is longer than \c B_MIME_TYPE_LENGTH * 3. 208*a33f8fbdSAdrien Destugues \retval B_BAD_TYPE The attribute/resources the entry is stored in have 209*a33f8fbdSAdrien Destugues the wrong type. 210*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND No catalog entry is set on the file. 211*a33f8fbdSAdrien Destugues*/ 212*a33f8fbdSAdrien Destugues 213*a33f8fbdSAdrien Destugues 214*a33f8fbdSAdrien Destugues/*! 215*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetCatalogEntry(const char* catalogEntry) 216*a33f8fbdSAdrien Destugues \brief Sets the catalog entry of the associated file used for localization. 217*a33f8fbdSAdrien Destugues 218*a33f8fbdSAdrien Destugues If \a catalogEntry is \c NULL the file's catalog entry is unset. 219*a33f8fbdSAdrien Destugues 220*a33f8fbdSAdrien Destugues \param catalogEntry The catalog entry to be assigned to the file. 221*a33f8fbdSAdrien Destugues Of the form "x-vnd.Haiku-app:context:name". Must not be longer than 222*a33f8fbdSAdrien Destugues \c B_MIME_TYPE_LENGTH * 3 (including the terminating \c NUL). 223*a33f8fbdSAdrien Destugues The \a catalogEntry may be \c NULL. 224*a33f8fbdSAdrien Destugues 225*a33f8fbdSAdrien Destugues \returns a status code. 226*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 227*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 228*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \a catalogEntry is longer than 229*a33f8fbdSAdrien Destugues \c B_MIME_TYPE_LENGTH * 3. 230*a33f8fbdSAdrien Destugues*/ 231*a33f8fbdSAdrien Destugues 232*a33f8fbdSAdrien Destugues 233*a33f8fbdSAdrien Destugues//! @} 234*a33f8fbdSAdrien Destugues 235*a33f8fbdSAdrien Destugues 236*a33f8fbdSAdrien Destugues/*! 237*a33f8fbdSAdrien Destugues \name Application Flags 238*a33f8fbdSAdrien Destugues*/ 239*a33f8fbdSAdrien Destugues 240*a33f8fbdSAdrien Destugues 241*a33f8fbdSAdrien Destugues//! @{ 242*a33f8fbdSAdrien Destugues 243*a33f8fbdSAdrien Destugues 244*a33f8fbdSAdrien Destugues/*! 245*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetAppFlags(uint32* flags) const 246*a33f8fbdSAdrien Destugues \brief Gets the application \a flags of the associated file. 247*a33f8fbdSAdrien Destugues 248*a33f8fbdSAdrien Destugues \param flags A pointer to a pre-allocated \c uint32 into which the 249*a33f8fbdSAdrien Destugues application flags of the file are written. 250*a33f8fbdSAdrien Destugues 251*a33f8fbdSAdrien Destugues \returns A status code. 252*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 253*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 254*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a flags. 255*a33f8fbdSAdrien Destugues \retval B_BAD_TYPE The attribute/resources the flags are stored in have 256*a33f8fbdSAdrien Destugues the wrong type. 257*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND No application flags are set on the file. 258*a33f8fbdSAdrien Destugues*/ 259*a33f8fbdSAdrien Destugues 260*a33f8fbdSAdrien Destugues 261*a33f8fbdSAdrien Destugues/*! 262*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetAppFlags(uint32 flags) 263*a33f8fbdSAdrien Destugues \brief Sets the application \a flags of the associated file. 264*a33f8fbdSAdrien Destugues 265*a33f8fbdSAdrien Destugues \param flags The application \a flags to be assigned to the file. 266*a33f8fbdSAdrien Destugues 267*a33f8fbdSAdrien Destugues \returns A status code. 268*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 269*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object was not properly initialized. 270*a33f8fbdSAdrien Destugues*/ 271*a33f8fbdSAdrien Destugues 272*a33f8fbdSAdrien Destugues 273*a33f8fbdSAdrien Destugues/*! 274*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::RemoveAppFlags() 275*a33f8fbdSAdrien Destugues \brief Removes the application flags from the associated file. 276*a33f8fbdSAdrien Destugues 277*a33f8fbdSAdrien Destugues \returns A status code. 278*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 279*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object was not properly initialized. 280*a33f8fbdSAdrien Destugues*/ 281*a33f8fbdSAdrien Destugues 282*a33f8fbdSAdrien Destugues 283*a33f8fbdSAdrien Destugues//! @} 284*a33f8fbdSAdrien Destugues 285*a33f8fbdSAdrien Destugues 286*a33f8fbdSAdrien Destugues/*! 287*a33f8fbdSAdrien Destugues \name Supported MIME Types 288*a33f8fbdSAdrien Destugues*/ 289*a33f8fbdSAdrien Destugues 290*a33f8fbdSAdrien Destugues 291*a33f8fbdSAdrien Destugues//! @{ 292*a33f8fbdSAdrien Destugues 293*a33f8fbdSAdrien Destugues 294*a33f8fbdSAdrien Destugues/*! 295*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetSupportedTypes(BMessage* types) const 296*a33f8fbdSAdrien Destugues \brief Gets the MIME types supported by the application. 297*a33f8fbdSAdrien Destugues 298*a33f8fbdSAdrien Destugues The supported MIME types are added to a field "types" of type 299*a33f8fbdSAdrien Destugues \c B_STRING_TYPE in \a types. 300*a33f8fbdSAdrien Destugues 301*a33f8fbdSAdrien Destugues \param types A pointer to a pre-allocated BMessage into which the 302*a33f8fbdSAdrien Destugues MIME types supported by the application will be written. 303*a33f8fbdSAdrien Destugues 304*a33f8fbdSAdrien Destugues \returns A status code. 305*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 306*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 307*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a types. 308*a33f8fbdSAdrien Destugues \retval B_BAD_TYPE The attribute/resources that the supported types 309*a33f8fbdSAdrien Destugues are stored in have the wrong type. 310*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND No supported types are set on the file. 311*a33f8fbdSAdrien Destugues*/ 312*a33f8fbdSAdrien Destugues 313*a33f8fbdSAdrien Destugues 314*a33f8fbdSAdrien Destugues/*! 315*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetSupportedTypes(const BMessage* types, 316*a33f8fbdSAdrien Destugues bool syncAll) 317*a33f8fbdSAdrien Destugues \brief Sets the MIME types that are supported by the application and allows 318*a33f8fbdSAdrien Destugues you to specify whether or not the no longer supported types shall be 319*a33f8fbdSAdrien Destugues updated as well. 320*a33f8fbdSAdrien Destugues 321*a33f8fbdSAdrien Destugues If \a types is \c NULL then the application's supported types are unset. 322*a33f8fbdSAdrien Destugues 323*a33f8fbdSAdrien Destugues The supported MIME types must be stored in a field "types" of type 324*a33f8fbdSAdrien Destugues \c B_STRING_TYPE in \a types. 325*a33f8fbdSAdrien Destugues 326*a33f8fbdSAdrien Destugues The method informs the registrar about this news. 327*a33f8fbdSAdrien Destugues For each supported type the result of BMimeType::GetSupportingApps() 328*a33f8fbdSAdrien Destugues will afterwards include the signature of this application. That is, 329*a33f8fbdSAdrien Destugues the application file needs to have a signature set. 330*a33f8fbdSAdrien Destugues 331*a33f8fbdSAdrien Destugues \a syncAll specifies whether the no longer supported types shall be 332*a33f8fbdSAdrien Destugues updated as well, i.e. whether or not this application shall be removed 333*a33f8fbdSAdrien Destugues from the list of supporting applications. 334*a33f8fbdSAdrien Destugues 335*a33f8fbdSAdrien Destugues \param types The supported types to be assigned to the file. 336*a33f8fbdSAdrien Destugues May be \c NULL. 337*a33f8fbdSAdrien Destugues \param syncAll \c true to also synchronize the no-longer supported 338*a33f8fbdSAdrien Destugues types, \c false otherwise. 339*a33f8fbdSAdrien Destugues 340*a33f8fbdSAdrien Destugues \returns A status code. 341*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 342*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 343*a33f8fbdSAdrien Destugues*/ 344*a33f8fbdSAdrien Destugues 345*a33f8fbdSAdrien Destugues 346*a33f8fbdSAdrien Destugues/*! 347*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetSupportedTypes(const BMessage* types) 348*a33f8fbdSAdrien Destugues \brief Sets the MIME types supported by the application. 349*a33f8fbdSAdrien Destugues 350*a33f8fbdSAdrien Destugues This method is a short-hand for SetSupportedTypes(types, false). 351*a33f8fbdSAdrien Destugues \see SetSupportedType(const BMessage*, bool) for detailed information. 352*a33f8fbdSAdrien Destugues 353*a33f8fbdSAdrien Destugues \param types The supported types to be assigned to the file. 354*a33f8fbdSAdrien Destugues May be \c NULL. 355*a33f8fbdSAdrien Destugues \returns A status code. 356*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 357*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 358*a33f8fbdSAdrien Destugues*/ 359*a33f8fbdSAdrien Destugues 360*a33f8fbdSAdrien Destugues 361*a33f8fbdSAdrien Destugues/*! 362*a33f8fbdSAdrien Destugues \fn bool BAppFileInfo::IsSupportedType(const char* type) const 363*a33f8fbdSAdrien Destugues \brief Returns whether the application supports the supplied MIME type. 364*a33f8fbdSAdrien Destugues 365*a33f8fbdSAdrien Destugues If the application supports the wildcard type "application/octet-stream" 366*a33f8fbdSAdrien Destugues then this method returns \c true for any MIME type. 367*a33f8fbdSAdrien Destugues 368*a33f8fbdSAdrien Destugues \param type The MIME type in question. 369*a33f8fbdSAdrien Destugues 370*a33f8fbdSAdrien Destugues \returns \c true if \a type is a valid MIME type and it is supported by 371*a33f8fbdSAdrien Destugues the application, \c false otherwise. 372*a33f8fbdSAdrien Destugues*/ 373*a33f8fbdSAdrien Destugues 374*a33f8fbdSAdrien Destugues 375*a33f8fbdSAdrien Destugues/*! 376*a33f8fbdSAdrien Destugues \fn bool BAppFileInfo::Supports(BMimeType* type) const 377*a33f8fbdSAdrien Destugues \brief Returns whether the application supports the supplied MIME type 378*a33f8fbdSAdrien Destugues explicitly. 379*a33f8fbdSAdrien Destugues 380*a33f8fbdSAdrien Destugues Unlike IsSupportedType(), this method returns \c true, only if the type 381*a33f8fbdSAdrien Destugues is explicitly supported, regardless of whether it supports 382*a33f8fbdSAdrien Destugues "application/octet-stream". 383*a33f8fbdSAdrien Destugues 384*a33f8fbdSAdrien Destugues \param type The MIME type in question. 385*a33f8fbdSAdrien Destugues 386*a33f8fbdSAdrien Destugues \returns \c true if \a type is a valid MIME type and it is explicitly 387*a33f8fbdSAdrien Destugues supported by the application, \c false otherwise. 388*a33f8fbdSAdrien Destugues*/ 389*a33f8fbdSAdrien Destugues 390*a33f8fbdSAdrien Destugues 391*a33f8fbdSAdrien Destugues//! @} 392*a33f8fbdSAdrien Destugues 393*a33f8fbdSAdrien Destugues 394*a33f8fbdSAdrien Destugues/*! 395*a33f8fbdSAdrien Destugues \name Application Icon 396*a33f8fbdSAdrien Destugues*/ 397*a33f8fbdSAdrien Destugues 398*a33f8fbdSAdrien Destugues 399*a33f8fbdSAdrien Destugues//! @{ 400*a33f8fbdSAdrien Destugues 401*a33f8fbdSAdrien Destugues 402*a33f8fbdSAdrien Destugues/*! 403*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetIcon(BBitmap* icon, icon_size which) const 404*a33f8fbdSAdrien Destugues \brief Gets the icon of the associated file and puts it into a pre-allocated 405*a33f8fbdSAdrien Destugues BBitmap. 406*a33f8fbdSAdrien Destugues 407*a33f8fbdSAdrien Destugues \param icon A pointer to a pre-allocated BBitmap of the correct dimension 408*a33f8fbdSAdrien Destugues to store the requested icon (16x16 for the \c B_MINI_ICON and 32x32 409*a33f8fbdSAdrien Destugues for the \c B_LARGE_ICON). 410*a33f8fbdSAdrien Destugues \param which Specifies the size of the icon to be retrieved: 411*a33f8fbdSAdrien Destugues \c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon. 412*a33f8fbdSAdrien Destugues For HVIF icons this parameter has no effect. 413*a33f8fbdSAdrien Destugues 414*a33f8fbdSAdrien Destugues \returns A status code. 415*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 416*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 417*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a icon, unsupported icon size \a which or 418*a33f8fbdSAdrien Destugues bitmap dimensions (\a icon) and icon size (\a which) do not match. 419*a33f8fbdSAdrien Destugues*/ 420*a33f8fbdSAdrien Destugues 421*a33f8fbdSAdrien Destugues 422*a33f8fbdSAdrien Destugues/*! 423*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetIcon(uint8** data, size_t* size) const 424*a33f8fbdSAdrien Destugues \brief Gets the icon of the associated file and puts it into a buffer. 425*a33f8fbdSAdrien Destugues 426*a33f8fbdSAdrien Destugues \param data The pointer in which the flat icon data will be returned. 427*a33f8fbdSAdrien Destugues \param size The pointer in which the size of the data found will be 428*a33f8fbdSAdrien Destugues returned. 429*a33f8fbdSAdrien Destugues 430*a33f8fbdSAdrien Destugues \returns A status code. 431*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 432*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 433*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a data or \c NULL size. 434*a33f8fbdSAdrien Destugues*/ 435*a33f8fbdSAdrien Destugues 436*a33f8fbdSAdrien Destugues 437*a33f8fbdSAdrien Destugues/*! 438*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetIcon(const BBitmap* icon, icon_size which) 439*a33f8fbdSAdrien Destugues \brief Sets the icon of the associated file from a BBitmap. 440*a33f8fbdSAdrien Destugues 441*a33f8fbdSAdrien Destugues If \a icon is \c NULL then the icon of the file is unset. 442*a33f8fbdSAdrien Destugues 443*a33f8fbdSAdrien Destugues \param icon A pointer to the BBitmap containing the icon to be set. 444*a33f8fbdSAdrien Destugues May be \c NULL to specify no icon. 445*a33f8fbdSAdrien Destugues \param which Specifies the size of the icon to be set: \c B_MINI_ICON for 446*a33f8fbdSAdrien Destugues 16x16 mini icon and \c B_LARGE_ICON for the 32x32 large icon. 447*a33f8fbdSAdrien Destugues For HVIF icons this parameter has no effect. 448*a33f8fbdSAdrien Destugues 449*a33f8fbdSAdrien Destugues \returns A status code. 450*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 451*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 452*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE Unknown icon size \a which or bitmap dimensions 453*a33f8fbdSAdrien Destugues (\a icon) and icon size (\a which) do not match. 454*a33f8fbdSAdrien Destugues*/ 455*a33f8fbdSAdrien Destugues 456*a33f8fbdSAdrien Destugues 457*a33f8fbdSAdrien Destugues/*! 458*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetIcon(const uint8* data, size_t size) 459*a33f8fbdSAdrien Destugues \brief Sets the icon of the associated file from a buffer. 460*a33f8fbdSAdrien Destugues 461*a33f8fbdSAdrien Destugues If \a data is \c NULL then the icon of the file is unset. 462*a33f8fbdSAdrien Destugues 463*a33f8fbdSAdrien Destugues \param data A pointer to the data buffer containing the vector icon 464*a33f8fbdSAdrien Destugues to be set. May be \c NULL. 465*a33f8fbdSAdrien Destugues \param size Specifies the size of buffer pointed to by \a data. 466*a33f8fbdSAdrien Destugues 467*a33f8fbdSAdrien Destugues \returns A status code. 468*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 469*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 470*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL data. 471*a33f8fbdSAdrien Destugues*/ 472*a33f8fbdSAdrien Destugues 473*a33f8fbdSAdrien Destugues 474*a33f8fbdSAdrien Destugues/*! 475*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetIconForType(const char* type, BBitmap* icon, 476*a33f8fbdSAdrien Destugues icon_size size) const 477*a33f8fbdSAdrien Destugues \brief Gets the icon the application provides for a given MIME type and 478*a33f8fbdSAdrien Destugues puts it into a BBitmap. 479*a33f8fbdSAdrien Destugues 480*a33f8fbdSAdrien Destugues \note If \a type is \c NULL, the application's icon is retrieved. 481*a33f8fbdSAdrien Destugues 482*a33f8fbdSAdrien Destugues \param type The MIME type in question. May be \c NULL. 483*a33f8fbdSAdrien Destugues \param icon A pointer to a pre-allocated BBitmap of the correct dimension 484*a33f8fbdSAdrien Destugues to store the requested icon (16x16 for the mini and 32x32 for the 485*a33f8fbdSAdrien Destugues large icon). 486*a33f8fbdSAdrien Destugues \param size Specifies the size of the icon to be retrieved: 487*a33f8fbdSAdrien Destugues \c B_MINI_ICON for the mini and \c B_LARGE_ICON for the large icon. 488*a33f8fbdSAdrien Destugues 489*a33f8fbdSAdrien Destugues \returns A status code. 490*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 491*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 492*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a icon, unsupported icon size 493*a33f8fbdSAdrien Destugues \a which or bitmap dimensions (\a icon) and icon size (\a which) do 494*a33f8fbdSAdrien Destugues not match. 495*a33f8fbdSAdrien Destugues*/ 496*a33f8fbdSAdrien Destugues 497*a33f8fbdSAdrien Destugues 498*a33f8fbdSAdrien Destugues/*! 499*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetIconForType(const char* type, uint8** data, 500*a33f8fbdSAdrien Destugues size_t* size) const 501*a33f8fbdSAdrien Destugues \brief Gets the icon the application provides for a given MIME type and 502*a33f8fbdSAdrien Destugues puts it into a buffer. 503*a33f8fbdSAdrien Destugues 504*a33f8fbdSAdrien Destugues \note If \a type is set to \c NULL the the application's icon is retrieved. 505*a33f8fbdSAdrien Destugues 506*a33f8fbdSAdrien Destugues \param type The MIME type in question. May be \c NULL. 507*a33f8fbdSAdrien Destugues \param data A pointer in which the icon data will be returned. When you 508*a33f8fbdSAdrien Destugues are done with the data, you should use free() to deallocate it. 509*a33f8fbdSAdrien Destugues \param size A pointer in which the size of the retrieved data is returned. 510*a33f8fbdSAdrien Destugues 511*a33f8fbdSAdrien Destugues \returns A status code. 512*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 513*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 514*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a data and/or \a size. Or the supplied 515*a33f8fbdSAdrien Destugues \a type is not a valid MIME type. 516*a33f8fbdSAdrien Destugues*/ 517*a33f8fbdSAdrien Destugues 518*a33f8fbdSAdrien Destugues 519*a33f8fbdSAdrien Destugues/*! 520*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetIconForType(const char* type, 521*a33f8fbdSAdrien Destugues const BBitmap* icon, icon_size which) 522*a33f8fbdSAdrien Destugues \brief Sets the icon the application provides for a given MIME type from a 523*a33f8fbdSAdrien Destugues BBitmap. 524*a33f8fbdSAdrien Destugues 525*a33f8fbdSAdrien Destugues \note If \a type is \c NULL then the icon is set. 526*a33f8fbdSAdrien Destugues \note If \a icon is \c NULL then the icon is unset. 527*a33f8fbdSAdrien Destugues 528*a33f8fbdSAdrien Destugues If the file has a signature, then the icon is also set on the MIME type. 529*a33f8fbdSAdrien Destugues If the type for the signature has not been installed yet, it is installed 530*a33f8fbdSAdrien Destugues before. 531*a33f8fbdSAdrien Destugues 532*a33f8fbdSAdrien Destugues \param type The MIME type in question. May be \c NULL. 533*a33f8fbdSAdrien Destugues \param icon A pointer to the BBitmap containing the icon to be set. 534*a33f8fbdSAdrien Destugues May be \c NULL. 535*a33f8fbdSAdrien Destugues \param which Specifies the size of the icon to be set: \c B_MINI_ICON 536*a33f8fbdSAdrien Destugues for the mini and \c B_LARGE_ICON for the large icon. 537*a33f8fbdSAdrien Destugues 538*a33f8fbdSAdrien Destugues \returns A status code. 539*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 540*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 541*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE Either the icon size \a which is unknown, 542*a33f8fbdSAdrien Destugues the bitmap dimensions (\a icon) and icon size (\a which) do not 543*a33f8fbdSAdrien Destugues match, or the provided \a type is not a valid MIME type. 544*a33f8fbdSAdrien Destugues*/ 545*a33f8fbdSAdrien Destugues 546*a33f8fbdSAdrien Destugues 547*a33f8fbdSAdrien Destugues/*! 548*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetIconForType(const char* type, 549*a33f8fbdSAdrien Destugues const uint8* data, size_t size) 550*a33f8fbdSAdrien Destugues \brief Sets the icon the application provides for a given MIME type from a 551*a33f8fbdSAdrien Destugues buffer. 552*a33f8fbdSAdrien Destugues 553*a33f8fbdSAdrien Destugues \note If \a type is \c NULL then the icon is set. 554*a33f8fbdSAdrien Destugues \note If \a data is \c NULL then the icon is unset. 555*a33f8fbdSAdrien Destugues 556*a33f8fbdSAdrien Destugues If the file has a signature, then the icon is also set on the MIME type. 557*a33f8fbdSAdrien Destugues If the type for the signature has not been installed yet, it is 558*a33f8fbdSAdrien Destugues installed before. 559*a33f8fbdSAdrien Destugues 560*a33f8fbdSAdrien Destugues \param type The MIME type in question. May be \c NULL. 561*a33f8fbdSAdrien Destugues \param data A pointer to the data containing the icon to be set. 562*a33f8fbdSAdrien Destugues May be \c NULL. 563*a33f8fbdSAdrien Destugues \param size Specifies the size of buffer provided in \a data. 564*a33f8fbdSAdrien Destugues 565*a33f8fbdSAdrien Destugues \returns A status code. 566*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 567*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 568*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE The provided \a type is not a valid MIME type. 569*a33f8fbdSAdrien Destugues*/ 570*a33f8fbdSAdrien Destugues 571*a33f8fbdSAdrien Destugues 572*a33f8fbdSAdrien Destugues//! @} 573*a33f8fbdSAdrien Destugues 574*a33f8fbdSAdrien Destugues 575*a33f8fbdSAdrien Destugues/*! 576*a33f8fbdSAdrien Destugues \name Version Info 577*a33f8fbdSAdrien Destugues*/ 578*a33f8fbdSAdrien Destugues 579*a33f8fbdSAdrien Destugues 580*a33f8fbdSAdrien Destugues//! @{ 581*a33f8fbdSAdrien Destugues 582*a33f8fbdSAdrien Destugues 583*a33f8fbdSAdrien Destugues/*! 584*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetVersionInfo(version_info* info, 585*a33f8fbdSAdrien Destugues version_kind kind) const 586*a33f8fbdSAdrien Destugues \brief Gets the version info of the associated file. 587*a33f8fbdSAdrien Destugues 588*a33f8fbdSAdrien Destugues \param info A pointer to a pre-allocated version_info structure into 589*a33f8fbdSAdrien Destugues which the version info should be written. 590*a33f8fbdSAdrien Destugues \param kind Specifies the kind of the version info to be retrieved: 591*a33f8fbdSAdrien Destugues - \c B_APP_VERSION_KIND for the application's version info and 592*a33f8fbdSAdrien Destugues - \c B_SYSTEM_VERSION_KIND for the suite's info the application 593*a33f8fbdSAdrien Destugues belongs to. 594*a33f8fbdSAdrien Destugues 595*a33f8fbdSAdrien Destugues \returns A status code. 596*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 597*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 598*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a info. 599*a33f8fbdSAdrien Destugues*/ 600*a33f8fbdSAdrien Destugues 601*a33f8fbdSAdrien Destugues 602*a33f8fbdSAdrien Destugues/*! 603*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::SetVersionInfo(const version_info* info, 604*a33f8fbdSAdrien Destugues version_kind kind) 605*a33f8fbdSAdrien Destugues \brief Sets the version info of the associated file. 606*a33f8fbdSAdrien Destugues 607*a33f8fbdSAdrien Destugues \note If \a info is set to \c NULL then the file's version info is unset. 608*a33f8fbdSAdrien Destugues 609*a33f8fbdSAdrien Destugues \param info The version info to be set. May be \c NULL. 610*a33f8fbdSAdrien Destugues \param kind Specifies kind of version info to be set: 611*a33f8fbdSAdrien Destugues - \c B_APP_VERSION_KIND for the application's version info and 612*a33f8fbdSAdrien Destugues - \c B_SYSTEM_VERSION_KIND for the suite's info the application 613*a33f8fbdSAdrien Destugues belongs to. 614*a33f8fbdSAdrien Destugues 615*a33f8fbdSAdrien Destugues \returns A status code. 616*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 617*a33f8fbdSAdrien Destugues \retval B_NO_INIT The object is not properly initialized. 618*a33f8fbdSAdrien Destugues*/ 619*a33f8fbdSAdrien Destugues 620*a33f8fbdSAdrien Destugues 621*a33f8fbdSAdrien Destugues//! @} 622*a33f8fbdSAdrien Destugues 623*a33f8fbdSAdrien Destugues 624*a33f8fbdSAdrien Destugues/*! 625*a33f8fbdSAdrien Destugues \name Attributes/Resources 626*a33f8fbdSAdrien Destugues*/ 627*a33f8fbdSAdrien Destugues 628*a33f8fbdSAdrien Destugues 629*a33f8fbdSAdrien Destugues//! @{ 630*a33f8fbdSAdrien Destugues 631*a33f8fbdSAdrien Destugues 632*a33f8fbdSAdrien Destugues/*! 633*a33f8fbdSAdrien Destugues \fn void BAppFileInfo::SetInfoLocation(info_location location) 634*a33f8fbdSAdrien Destugues \brief Specifies the location where the metadata shall be stored. 635*a33f8fbdSAdrien Destugues 636*a33f8fbdSAdrien Destugues The options for \a location are: 637*a33f8fbdSAdrien Destugues - \c B_USE_ATTRIBUTES: Store the data in the attributes. 638*a33f8fbdSAdrien Destugues - \c B_USE_RESOURCES: Store the data in the resources. 639*a33f8fbdSAdrien Destugues - \c B_USE_BOTH_LOCATIONS: Store the data in attributes and resources. 640*a33f8fbdSAdrien Destugues 641*a33f8fbdSAdrien Destugues \param location The location where the metadata shall be stored. 642*a33f8fbdSAdrien Destugues*/ 643*a33f8fbdSAdrien Destugues 644*a33f8fbdSAdrien Destugues 645*a33f8fbdSAdrien Destugues/*! 646*a33f8fbdSAdrien Destugues \fn bool BAppFileInfo::IsUsingAttributes() const 647*a33f8fbdSAdrien Destugues \brief Returns whether the object (also) stores the metadata in the 648*a33f8fbdSAdrien Destugues attributes of the associated file. 649*a33f8fbdSAdrien Destugues 650*a33f8fbdSAdrien Destugues \returns \c true if the metadata are (also) stored in the file's 651*a33f8fbdSAdrien Destugues attributes, \c false otherwise. 652*a33f8fbdSAdrien Destugues*/ 653*a33f8fbdSAdrien Destugues 654*a33f8fbdSAdrien Destugues 655*a33f8fbdSAdrien Destugues/*! 656*a33f8fbdSAdrien Destugues \fn bool BAppFileInfo::IsUsingResources() const 657*a33f8fbdSAdrien Destugues \brief Returns whether the object (also) stores the metadata in the 658*a33f8fbdSAdrien Destugues resources of the associated file. 659*a33f8fbdSAdrien Destugues 660*a33f8fbdSAdrien Destugues \returns \c true if the metadata are (also) stored in the file's 661*a33f8fbdSAdrien Destugues resources, \c false otherwise. 662*a33f8fbdSAdrien Destugues*/ 663*a33f8fbdSAdrien Destugues 664*a33f8fbdSAdrien Destugues 665*a33f8fbdSAdrien Destugues//! @} 666*a33f8fbdSAdrien Destugues 667*a33f8fbdSAdrien Destugues 668*a33f8fbdSAdrien Destugues/*! 669*a33f8fbdSAdrien Destugues \fn BAppFileInfo & BAppFileInfo::operator=(const BAppFileInfo &) 670*a33f8fbdSAdrien Destugues \brief Privatized assignment operator to prevent usage. 671*a33f8fbdSAdrien Destugues*/ 672*a33f8fbdSAdrien Destugues 673*a33f8fbdSAdrien Destugues 674*a33f8fbdSAdrien Destugues/*! 675*a33f8fbdSAdrien Destugues \fn BAppFileInfo::BAppFileInfo(const BAppFileInfo &) 676*a33f8fbdSAdrien Destugues \brief Privatized copy constructor to prevent usage. 677*a33f8fbdSAdrien Destugues*/ 678*a33f8fbdSAdrien Destugues 679*a33f8fbdSAdrien Destugues 680*a33f8fbdSAdrien Destugues/*! 681*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::GetMetaMime(BMimeType* meta) const 682*a33f8fbdSAdrien Destugues \brief Initializes a BMimeType to the signature of the associated file. 683*a33f8fbdSAdrien Destugues 684*a33f8fbdSAdrien Destugues \warning The parameter \a meta is not checked. 685*a33f8fbdSAdrien Destugues 686*a33f8fbdSAdrien Destugues \param meta A pointer to a pre-allocated BMimeType that shall be 687*a33f8fbdSAdrien Destugues initialized to the signature of the associated file. 688*a33f8fbdSAdrien Destugues 689*a33f8fbdSAdrien Destugues \returns A status code. 690*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 691*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \c NULL \a meta 692*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND The file has not signature or the signature is 693*a33f8fbdSAdrien Destugues (not installed in the MIME database.) no valid MIME string. 694*a33f8fbdSAdrien Destugues*/ 695*a33f8fbdSAdrien Destugues 696*a33f8fbdSAdrien Destugues 697*a33f8fbdSAdrien Destugues/*! 698*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::_ReadData(const char* name, int32 id, 699*a33f8fbdSAdrien Destugues type_code type, void* buffer, size_t bufferSize, 700*a33f8fbdSAdrien Destugues size_t &bytesRead, void** allocatedBuffer) const 701*a33f8fbdSAdrien Destugues \brief Reads data from an attribute or resource. 702*a33f8fbdSAdrien Destugues 703*a33f8fbdSAdrien Destugues \note The data is read from the location specified by \a fWhere. 704*a33f8fbdSAdrien Destugues 705*a33f8fbdSAdrien Destugues \warning The object must be properly initialized. The parameters are 706*a33f8fbdSAdrien Destugues \b NOT checked. 707*a33f8fbdSAdrien Destugues 708*a33f8fbdSAdrien Destugues \param name The name of the attribute/resource to be read. 709*a33f8fbdSAdrien Destugues \param id The resource ID of the resource to be read. It is ignored 710*a33f8fbdSAdrien Destugues when < 0. 711*a33f8fbdSAdrien Destugues \param type The type of the attribute/resource to be read. 712*a33f8fbdSAdrien Destugues \param buffer A pre-allocated buffer for the data to be read. 713*a33f8fbdSAdrien Destugues \param bufferSize The size of the supplied buffer. 714*a33f8fbdSAdrien Destugues \param bytesRead A reference parameter, set to the number of bytes 715*a33f8fbdSAdrien Destugues actually read. 716*a33f8fbdSAdrien Destugues \param allocatedBuffer If not \c NULL, the method allocates a buffer 717*a33f8fbdSAdrien Destugues large enough too store the whole data and writes a pointer to it 718*a33f8fbdSAdrien Destugues into this variable. If \c NULL, the supplied buffer is used. 719*a33f8fbdSAdrien Destugues 720*a33f8fbdSAdrien Destugues \returns A status code. 721*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 722*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND The entry was not found. 723*a33f8fbdSAdrien Destugues \retval B_NO_MEMORY Ran out of memory allocating the buffer. 724*a33f8fbdSAdrien Destugues \retval B_BAD_VALUE \a type did not match. 725*a33f8fbdSAdrien Destugues*/ 726*a33f8fbdSAdrien Destugues 727*a33f8fbdSAdrien Destugues 728*a33f8fbdSAdrien Destugues/*! 729*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::_WriteData(const char* name, int32 id, 730*a33f8fbdSAdrien Destugues type_code type, const void* buffer, size_t bufferSize, bool findID) 731*a33f8fbdSAdrien Destugues \brief Writes data to an attribute or resource. 732*a33f8fbdSAdrien Destugues 733*a33f8fbdSAdrien Destugues \note The data is written to the location(s) specified by \a fWhere. 734*a33f8fbdSAdrien Destugues 735*a33f8fbdSAdrien Destugues \warning The object must be properly initialized. The parameters are 736*a33f8fbdSAdrien Destugues \b NOT checked. 737*a33f8fbdSAdrien Destugues 738*a33f8fbdSAdrien Destugues \param name The name of the attribute/resource to be written. 739*a33f8fbdSAdrien Destugues \param id The resource ID of the resource to be written. 740*a33f8fbdSAdrien Destugues \param type The type of the attribute/resource to be written. 741*a33f8fbdSAdrien Destugues \param buffer A buffer containing the data to be written. 742*a33f8fbdSAdrien Destugues \param bufferSize The size of the supplied buffer. 743*a33f8fbdSAdrien Destugues \param findID If set to \c true use the ID that is already assigned to the 744*a33f8fbdSAdrien Destugues \a name / \a type pair or take the first unused ID >= \a id. 745*a33f8fbdSAdrien Destugues If \c false, \a id is used. 746*a33f8fbdSAdrien Destugues 747*a33f8fbdSAdrien Destugues \returns A status code. 748*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 749*a33f8fbdSAdrien Destugues \retval B_ERROR An error occurred while trying to write the data. 750*a33f8fbdSAdrien Destugues*/ 751*a33f8fbdSAdrien Destugues 752*a33f8fbdSAdrien Destugues 753*a33f8fbdSAdrien Destugues/*! 754*a33f8fbdSAdrien Destugues \fn status_t BAppFileInfo::_RemoveData(const char* name, type_code type) 755*a33f8fbdSAdrien Destugues \brief Removes an attribute or resource. 756*a33f8fbdSAdrien Destugues 757*a33f8fbdSAdrien Destugues \note The removal location is specified by \a fWhere. 758*a33f8fbdSAdrien Destugues 759*a33f8fbdSAdrien Destugues \warning The object must be properly initialized. The parameters are 760*a33f8fbdSAdrien Destugues \b NOT checked. 761*a33f8fbdSAdrien Destugues 762*a33f8fbdSAdrien Destugues \param name The name of the attribute/resource to be remove. 763*a33f8fbdSAdrien Destugues \param type The type of the attribute/resource to be removed. 764*a33f8fbdSAdrien Destugues 765*a33f8fbdSAdrien Destugues \returns A status code. 766*a33f8fbdSAdrien Destugues \retval B_OK Everything went fine. 767*a33f8fbdSAdrien Destugues \retval B_NO_INIT Not using attributes and not using resources. 768*a33f8fbdSAdrien Destugues \retval B_ENTRY_NOT_FOUND The attribute or resource was not found. 769*a33f8fbdSAdrien Destugues*/ 770