Loading...
Searching...
No Matches
Enumerations | Functions
Mime.h File Reference

Provides C and Haiku-only C++ MIME-type handling functions. More...

Enumerations

enum  {
  B_UPDATE_MIME_INFO_NO_FORCE = 0 ,
  B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE = 1 ,
  B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL = 2
}
 
enum  icon_size {
  B_LARGE_ICON = 32 ,
  B_MINI_ICON = 16
}
 

Functions

status_t create_app_meta_mime (const char *path, int recursive, int synchronous, int force)
 Creates a MIME database entry for one or more applications.
 
status_t get_device_icon (const char *device, BBitmap *icon, icon_size which)
 Retrieves an icon associated with a given device into a BBitmap, C++ only.
 
status_t get_device_icon (const char *device, uint8 **_data, size_t *_size, type_code *_type)
 Try to get the icon by name first, if that fails try to get the vector icon, C++ only.
 
status_t get_device_icon (const char *device, void *icon, int32 size)
 Retrieves an icon associated with a given device.
 
status_t get_named_icon (const char *name, BBitmap *icon, icon_size which)
 Get the icon by name, C++ only.
 
status_t get_named_icon (const char *name, uint8 **_data, size_t *_size, type_code *_type)
 Get the icon by name, C++ only.
 
int update_mime_info (const char *path, int recursive, int synchronous, int force)
 Updates the MIME information (i.e MIME type) for one or more files.
 

Detailed Description

Provides C and Haiku-only C++ MIME-type handling functions.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
B_UPDATE_MIME_INFO_NO_FORCE 

Files that already have a BEOS:TYPE attribute won't be updated.

Since
Haiku R1
B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE 

Files that already have a BEOS:TYPE attribute will be updated too, but BEOS:TYPE itself will remain untouched.

Since
Haiku R1
B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL 

Similar to B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE, but the BEOS:TYPE attribute will be updated too.

Since
Haiku R1

◆ icon_size

enum icon_size
Enumerator
B_LARGE_ICON 

32x32 "Large" icon.

Since
BeOS R3
B_MINI_ICON 

16x16 "Mini" icon.

Since
BeOS R3

Function Documentation

◆ create_app_meta_mime()

status_t create_app_meta_mime ( const char *  path,
int  recursive,
int  synchronous,
int  force 
)

Creates a MIME database entry for one or more applications.

If path points to an application file, a MIME DB entry is create for the application. If it points to a directory and recursive is not NULL then entries are created for all application files in the given directory tree. If path is NULL then all files are considered and recursive is ignored.

Parameters
pathThe path to an application file, a directory, or NULL.
recursiveTrigger recursive behavior if not NULL.
synchronousWaits until the operation is finished if not NULL, otherwise it returns immediately and the operation is done asynchronously.
forceEntries are created even if they do already exist if not NULL.
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Since
BeOS R3

◆ get_device_icon() [1/3]

status_t get_device_icon ( const char *  device,
BBitmap icon,
icon_size  which 
)

Retrieves an icon associated with a given device into a BBitmap, C++ only.

Parameters
deviceThe path to the device.
iconA pointer to a pre-allocated BBitmap of the correct dimension to store the requested icon (16x16 for the mini and 32x32 for the large icon).
whichThe size of the icon to retrieve. Currently 16 (B_MINI_ICON) and 32 (B_LARGE_ICON) are supported.
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Return values
B_OKRetrieved the icon successfully.
B_BAD_VALUEdevice or icon was NULL.
Since
Haiku R1

◆ get_device_icon() [2/3]

status_t get_device_icon ( const char *  device,
uint8 **  _data,
size_t *  _size,
type_code _type 
)

Try to get the icon by name first, if that fails try to get the vector icon, C++ only.

Parameters
deviceThe path to the device.
_dataA pointer to a pointer to an array of uint8 pixel data to fill out.
_sizeThe size of the icon to fill out. If vector, it is filled in with the width in pixels, if bitmap, one of the following constants:
  • B_MINI_ICON
  • B_LARGE_ICON
_typeThe icon type code to fill out, one of the following:
  • B_MINI_ICON_TYPE
  • B_LARGE_ICON_TYPE
  • B_VECTOR_ICON_TYPE
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Return values
B_OKRetrieved the icon successfully.
B_BAD_VALUEdevice, _data, _size, or _type was NULL.
Since
Haiku R1

◆ get_device_icon() [3/3]

status_t get_device_icon ( const char *  device,
void *  icon,
int32  size 
)

Retrieves an icon associated with a given device.

Parameters
deviceThe path to the device.
iconA pointer to a buffer the icon data shall be written to.
sizeThe size of the icon to retrieve. Currently 16 (B_MINI_ICON) and 32 (B_LARGE_ICON) are supported.
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Return values
B_OKRetrieved the icon successfully.
B_BAD_VALUEdevice or icon was NULL.
B_NO_MEMORYRan out of memory allocating bitmap.
Since
BeOS R3

◆ get_named_icon() [1/2]

status_t get_named_icon ( const char *  name,
BBitmap icon,
icon_size  which 
)

Get the icon by name, C++ only.

Parameters
nameThe name of the icon to get.
iconA pointer to a pre-allocated BBitmap of the correct dimension to store the requested icon (16x16 for the mini and 32x32 for the large icon).
whichThe size of the icon to retrieve. Currently 16 (B_MINI_ICON) and 32 (B_LARGE_ICON) are supported.
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Return values
B_OKRetrieved the icon successfully.
B_BAD_VALUEname or icon was NULL.
Since
Haiku R1

◆ get_named_icon() [2/2]

status_t get_named_icon ( const char *  name,
uint8 **  _data,
size_t *  _size,
type_code _type 
)

Get the icon by name, C++ only.

Parameters
nameThe name of the icon to get.
_dataA pointer to a pointer to an array of uint8 pixel data to fill out.
_sizeThe size of the icon to fill out. If vector, it is filled in with the width in pixels, if bitmap, one of the following constants:
  • B_MINI_ICON
  • B_LARGE_ICON
_typeThe icon type code to fill out, one of the following:
  • B_MINI_ICON_TYPE
  • B_LARGE_ICON_TYPE
  • B_VECTOR_ICON_TYPE
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Return values
B_OKRetrieved the icon successfully.
B_BAD_VALUEname, _data, _size, or _type was NULL.
Since
Haiku R1

◆ update_mime_info()

int update_mime_info ( const char *  path,
int  recursive,
int  synchronous,
int  force 
)

Updates the MIME information (i.e MIME type) for one or more files.

If path points to a file, the MIME information for this file are updated only. If it points to a directory and recursive is non-null, the information for all the files in the given directory tree are updated. If path is NULL all files are considered; recursive is ignored in this case.

Parameters
pathThe path to a file or directory, or NULL.
recursiveTriggers recursive behavior if not NULL.
synchronousIf not NULL update_mime_info() waits until the operation is finished, otherwise it returns immediately and the update is done asynchronously.
forceSpecifies how to handle files that already have MIME information. See enum definitions for more information:
  • B_UPDATE_MIME_INFO_NO_FORCE
  • B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE
  • B_UPDATE_MIME_INFO_FORCE_UPDATE_ALL
Returns
A status code, B_OK if everything went fine, an error code otherwise.
Since
BeOS R3