NetSurf
Macros | Functions
filetype.h File Reference

RISC OS filetpe interface. More...

#include "netsurf/content_type.h"
Include dependency graph for filetype.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FILETYPE_ACORN_URI   0xf91
 
#define FILETYPE_ANT_URL   0xb28
 
#define FILETYPE_IEURL   0x1ba
 
#define FILETYPE_HTML   0xfaf
 
#define FILETYPE_JNG   0xf78
 
#define FILETYPE_CSS   0xf79
 
#define FILETYPE_MNG   0xf83
 
#define FILETYPE_GIF   0x695
 
#define FILETYPE_BMP   0x69c
 
#define FILETYPE_ICO   0x132
 
#define FILETYPE_PNG   0xb60
 
#define FILETYPE_JPEG   0xc85
 
#define FILETYPE_ARTWORKS   0xd94
 
#define FILETYPE_SVG   0xaad
 
#define FILETYPE_WEBP   0xa66
 

Functions

const char * fetch_filetype (const char *unix_path)
 Determine the MIME type of a local file. More...
 
char * fetch_mimetype (const char *ro_path)
 Find a MIME type for a local file. More...
 
int ro_content_filetype (struct hlcache_handle *h)
 Determine the RISC OS filetype for a content. More...
 
int ro_content_native_type (struct hlcache_handle *c)
 Determine the native RISC OS filetype to export a content as. More...
 
int ro_content_filetype_from_mime_type (lwc_string *mime_type)
 Determine the RISC OS filetype for a MIME type. More...
 
int ro_content_filetype_from_type (content_type type)
 Determine the RISC OS filetype from a content type. More...
 
bits ro_filetype_from_unix_path (const char *unix_path)
 Determine the type of a local file. More...
 

Detailed Description

RISC OS filetpe interface.

Definition in file filetype.h.

Macro Definition Documentation

◆ FILETYPE_ACORN_URI

#define FILETYPE_ACORN_URI   0xf91

Definition at line 29 of file filetype.h.

◆ FILETYPE_ANT_URL

#define FILETYPE_ANT_URL   0xb28

Definition at line 32 of file filetype.h.

◆ FILETYPE_ARTWORKS

#define FILETYPE_ARTWORKS   0xd94

Definition at line 65 of file filetype.h.

◆ FILETYPE_BMP

#define FILETYPE_BMP   0x69c

Definition at line 53 of file filetype.h.

◆ FILETYPE_CSS

#define FILETYPE_CSS   0xf79

Definition at line 44 of file filetype.h.

◆ FILETYPE_GIF

#define FILETYPE_GIF   0x695

Definition at line 50 of file filetype.h.

◆ FILETYPE_HTML

#define FILETYPE_HTML   0xfaf

Definition at line 38 of file filetype.h.

◆ FILETYPE_ICO

#define FILETYPE_ICO   0x132

Definition at line 56 of file filetype.h.

◆ FILETYPE_IEURL

#define FILETYPE_IEURL   0x1ba

Definition at line 35 of file filetype.h.

◆ FILETYPE_JNG

#define FILETYPE_JNG   0xf78

Definition at line 41 of file filetype.h.

◆ FILETYPE_JPEG

#define FILETYPE_JPEG   0xc85

Definition at line 62 of file filetype.h.

◆ FILETYPE_MNG

#define FILETYPE_MNG   0xf83

Definition at line 47 of file filetype.h.

◆ FILETYPE_PNG

#define FILETYPE_PNG   0xb60

Definition at line 59 of file filetype.h.

◆ FILETYPE_SVG

#define FILETYPE_SVG   0xaad

Definition at line 68 of file filetype.h.

◆ FILETYPE_WEBP

#define FILETYPE_WEBP   0xa66

Definition at line 71 of file filetype.h.

Function Documentation

◆ fetch_filetype()

const char * fetch_filetype ( const char *  unix_path)

Determine the MIME type of a local file.

Parameters
unix_pathUnix style path to file on disk
Returns
Pointer to MIME type string (should not be freed) - invalidated on next call to fetch_filetype.

Determine the MIME type of a local file.

Definition at line 58 of file filetype.c.

References ami_mime_from_datatype(), ascii_to_lower(), BUF_SIZE, buffer, cmp_type(), default_types, ext1, ext2, type_entry::file_type, hash_get(), mime_hash, type_entry::mime_type, NSLOG, path(), ro_warn_user(), type, type_buf, type_map, and TYPE_MAP_COUNT.

Referenced by fetch_rsrc_process(), and HOOKF().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fetch_mimetype()

char * fetch_mimetype ( const char *  ro_path)

Find a MIME type for a local file.

Parameters
ro_pathRISC OS style path to file on disk
Returns
MIME type string (on heap, caller should free), or NULL

Definition at line 154 of file filetype.c.

References BUF_SIZE, cmp_type(), type_entry::mime_type, NSLOG, ro_warn_user(), type_map, and TYPE_MAP_COUNT.

Here is the call graph for this function:

◆ ro_content_filetype()

int ro_content_filetype ( struct hlcache_handle h)

Determine the RISC OS filetype for a content.

Parameters
hThe handle of the content to examine.
Returns
The RISC OS filetype corresponding to the content

Definition at line 243 of file filetype.c.

References content_get_mime_type(), content_get_type(), type_entry::file_type, type_entry::mime_type, ro_content_filetype_from_mime_type(), and ro_content_filetype_from_type().

Referenced by print_send_printsave(), ro_content_native_type(), ro_gui_save_content(), ro_gui_save_object_native(), ro_gui_save_set_state(), ro_gui_url_bar_set_content_favicon(), ro_gui_view_source(), ro_gui_window_prepare_objectinfo(), and ro_gui_window_prepare_pageinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_content_filetype_from_mime_type()

int ro_content_filetype_from_mime_type ( lwc_string *  mime_type)

Determine the RISC OS filetype for a MIME type.

Parameters
mime_typeMIME type to consider
Returns
Corresponding RISC OS filetype

Definition at line 288 of file filetype.c.

References type_entry::file_type, type_entry::mime_type, type_map, and TYPE_MAP_COUNT.

Referenced by ro_content_filetype(), and ro_gui_save_set_file_type().

Here is the caller graph for this function:

◆ ro_content_filetype_from_type()

int ro_content_filetype_from_type ( content_type  type)

Determine the RISC OS filetype from a content type.

Parameters
typeThe content type to examine.
Returns
The RISC OS filetype corresponding to the content, or 0 for unknown

Definition at line 315 of file filetype.c.

References CONTENT_CSS, CONTENT_HTML, CONTENT_TEXTPLAIN, FILETYPE_HTML, and type.

Referenced by ro_content_filetype(), and ro_gui_url_complete_redraw().

Here is the caller graph for this function:

◆ ro_content_native_type()

int ro_content_native_type ( struct hlcache_handle c)

Determine the native RISC OS filetype to export a content as.

Parameters
cThe content to examine
Returns
Native RISC OS filetype for export

Definition at line 263 of file filetype.c.

References FILETYPE_BMP, FILETYPE_GIF, FILETYPE_ICO, FILETYPE_JNG, FILETYPE_JPEG, FILETYPE_MNG, FILETYPE_PNG, FILETYPE_SVG, FILETYPE_WEBP, and ro_content_filetype().

Referenced by ro_gui_save_object_native(), ro_gui_save_set_state(), and ro_gui_window_content_export_types().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_filetype_from_unix_path()

bits ro_filetype_from_unix_path ( const char *  unix_path)

Determine the type of a local file.

Parameters
unix_pathUnix style path to file on disk
Returns
File type

Definition at line 327 of file filetype.c.

References type_entry::file_type, NSLOG, path(), and ro_warn_user().

Referenced by download_ro_filetype().

Here is the call graph for this function:
Here is the caller graph for this function: