1/* 2 * Copyright 2013 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold, bonefish@users.sf.net 7 * John Scipione, jscipione@gmail.com 8 * 9 * Corresponds to: 10 * headers/os/storage/Mime.h hrev45224 11 * src/kits/storage/Mime.cpp hrev45224 12 */ 13 14 15/*! 16 \file Mime.h 17 \ingroup storage 18 \ingroup libbe 19 \brief Provides C and Haiku-only C++ MIME-type handling functions. 20*/ 21 22 23/*! 24 \enum icon_size 25 \ingroup storage 26 \brief Legacy BeOS icon size constants. 27*/ 28 29 30/*! 31 \var icon_size B_LARGE_ICON 32 33 32x32 "Large" icon. 34*/ 35 36 37/*! 38 \var icon_size B_MINI_ICON 39 40 16x16 "Mini" icon. 41*/ 42 43 44/*! 45 \var B_UPDATE_MIME_INFO_NO_FORCE 46 47 Files that already have a \c BEOS:TYPE attribute won't be updated. 48*/ 49 50 51/*! 52 \var B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE 53 54 Files that already have a \c BEOS:TYPE attribute will be updated too, but 55 \c BEOS:TYPE itself will remain untouched. 56*/ 57 58 59/*! 60 \var B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL 61 62 Similar to \c B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE, but the \c BEOS:TYPE 63 attribute will be updated too. 64*/ 65 66 67/*! 68 \fn int update_mime_info(const char *path, int recursive, int synchronous, 69 int force) 70 \brief Updates the MIME information (i.e MIME type) for one or more files. 71 72 If \a path points to a file, the MIME information for this file are 73 updated only. If it points to a directory and \a recursive is non-null, 74 the information for all the files in the given directory tree are updated. 75 If path is \c NULL all files are considered; \a recursive is ignored in 76 this case. 77 78 \param path The path to a file or directory, or \c NULL. 79 \param recursive Triggers recursive behavior if not \c NULL. 80 \param synchronous If not \c NULL update_mime_info() waits until the 81 operation is finished, otherwise it returns immediately and the 82 update is done asynchronously. 83 \param force Specifies how to handle files that already have MIME 84 information. See enum definitions for more information. 85 - \c B_UPDATE_MIME_INFO_NO_FORCE 86 - \c B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE 87 - \c B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL 88 89 \returns A status code. \c B_OK if everything went fine, an error code 90 otherwise. 91*/ 92 93 94/*! 95 \fn status_t create_app_meta_mime(const char *path, int recursive, 96 int synchronous, int force) 97 \brief Creates a MIME database entry for one or more applications. 98 99 If \a path points to an application file, a MIME DB entry is create for 100 the application. If it points to a directory and \a recursive is not 101 \c NULL then entries are created for all application files in the given 102 directory tree. If path is \c NULL then all files are considered and 103 \a recursive is ignored. 104 105 \param path The path to an application file, a directory, or \c NULL. 106 \param recursive Trigger recursive behavior if not \c NULL. 107 \param synchronous Waits until the operation is finished if not \c NULL, 108 otherwise it returns immediately and the operation is done 109 asynchronously. 110 \param force Entries are created even if they do already exist if not 111 \c NULL. 112 113 \returns A status code. \c B_OK if everything went fine, an error code 114 otherwise. 115*/ 116 117 118/*! 119 \fn status_t get_device_icon(const char *device, void *icon, int32 size) 120 \brief Retrieves an icon associated with a given device. 121 122 \param device The path to the device. 123 \param icon A pointer to a buffer the icon data shall be written to. 124 \param size The size of the icon to retrieve. Currently 16 125 (\c B_MINI_ICON) and 32 (\c B_LARGE_ICON) are supported. 126 127 \returns A status code. 128 \retval B_OK Everything went fine. 129 \retval B_BAD_VALUE \a device or \a icon was \c NULL. 130 \retval B_NO_MEMORY Ran out of memory allocating bitmap. 131*/ 132 133 134/*! 135 \fn status_t get_device_icon(const char *device, BBitmap *icon, 136 icon_size which) 137 \brief Retrieves an icon associated with a given device into a BBitmap. 138 139 \param device The path to the device. 140 \param icon A pointer to a pre-allocated BBitmap of the correct dimension 141 to store the requested icon (16x16 for the mini and 32x32 for the 142 large icon). 143 \param which The size of the icon to retrieve. Currently 16 144 (\c B_MINI_ICON) and 32 (\c B_LARGE_ICON) are supported. 145 146 \returns A status code. \c B_OK if everything went fine, an error code 147 otherwise. 148*/ 149 150 151/*! 152 \fn status_t get_device_icon(const char* device, uint8** _data, 153 size_t* _size, type_code* _type); 154 \brief Undocumented. 155*/ 156 157 158/*! 159 \fn status_t get_named_icon(const char* name, BBitmap* icon, 160 icon_size which); 161 \brief Undocumented. 162*/ 163 164 165/*! 166 \fn status_t get_named_icon(const char* name, uint8** _data, 167 size_t* _size, type_code* _type); 168 \brief Undocumented. 169*/ 170