NetSurf
filetype.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/** \file riscos/filetype.h
20 * RISC OS filetpe interface.
21 */
22
23#ifndef _NETSURF_RISCOS_FILETYPE_H_
24#define _NETSURF_RISCOS_FILETYPE_H_
25
27
28#ifndef FILETYPE_ACORN_URI
29#define FILETYPE_ACORN_URI 0xf91
30#endif
31#ifndef FILETYPE_ANT_URL
32#define FILETYPE_ANT_URL 0xb28
33#endif
34#ifndef FILETYPE_IEURL
35#define FILETYPE_IEURL 0x1ba
36#endif
37#ifndef FILETYPE_HTML
38#define FILETYPE_HTML 0xfaf
39#endif
40#ifndef FILETYPE_JNG
41#define FILETYPE_JNG 0xf78
42#endif
43#ifndef FILETYPE_CSS
44#define FILETYPE_CSS 0xf79
45#endif
46#ifndef FILETYPE_MNG
47#define FILETYPE_MNG 0xf83
48#endif
49#ifndef FILETYPE_GIF
50#define FILETYPE_GIF 0x695
51#endif
52#ifndef FILETYPE_BMP
53#define FILETYPE_BMP 0x69c
54#endif
55#ifndef FILETYPE_ICO
56#define FILETYPE_ICO 0x132
57#endif
58#ifndef FILETYPE_PNG
59#define FILETYPE_PNG 0xb60
60#endif
61#ifndef FILETYPE_JPEG
62#define FILETYPE_JPEG 0xc85
63#endif
64#ifndef FILETYPE_ARTWORKS
65#define FILETYPE_ARTWORKS 0xd94
66#endif
67#ifndef FILETYPE_SVG
68#define FILETYPE_SVG 0xaad
69#endif
70#ifndef FILETYPE_WEBP
71#define FILETYPE_WEBP 0xa66
72#endif
73
74/**
75 * Determine the MIME type of a local file.
76 *
77 * \param unix_path Unix style path to file on disk
78 * \return Pointer to MIME type string (should not be freed) - invalidated
79 * on next call to fetch_filetype.
80 */
81const char *fetch_filetype(const char *unix_path);
82
83/**
84 * Find a MIME type for a local file
85 *
86 * \param ro_path RISC OS style path to file on disk
87 * \return MIME type string (on heap, caller should free), or NULL
88 */
89char *fetch_mimetype(const char *ro_path);
90
91/**
92 * Determine the RISC OS filetype for a content.
93 *
94 * \param h The handle of the content to examine.
95 * \return The RISC OS filetype corresponding to the content
96 */
98
99/**
100 * Determine the native RISC OS filetype to export a content as
101 *
102 * \param c The content to examine
103 * \return Native RISC OS filetype for export
104 */
106
107/**
108 * Determine the RISC OS filetype for a MIME type
109 *
110 * \param mime_type MIME type to consider
111 * \return Corresponding RISC OS filetype
112 */
113int ro_content_filetype_from_mime_type(lwc_string *mime_type);
114
115/**
116 * Determine the RISC OS filetype from a content type.
117 *
118 * \param type The content type to examine.
119 * \return The RISC OS filetype corresponding to the content, or 0 for unknown
120 */
122
123/**
124 * Determine the type of a local file.
125 *
126 * \param unix_path Unix style path to file on disk
127 * \return File type
128 */
129bits ro_filetype_from_unix_path(const char *unix_path);
130
131#endif
const char * fetch_filetype(const char *unix_path)
filetype – determine the MIME type of a local file
Definition: filetype.c:58
Declaration of content enumerations.
content_type
The type of a content.
Definition: content_type.h:53
const char * type
Definition: filetype.cpp:44
int ro_content_filetype_from_mime_type(lwc_string *mime_type)
Determine the RISC OS filetype for a MIME type.
Definition: filetype.c:288
char * fetch_mimetype(const char *ro_path)
Find a MIME type for a local file.
Definition: filetype.c:154
bits ro_filetype_from_unix_path(const char *unix_path)
Determine the type of a local file.
Definition: filetype.c:327
int ro_content_filetype_from_type(content_type type)
Determine the RISC OS filetype from a content type.
Definition: filetype.c:315
int ro_content_native_type(struct hlcache_handle *c)
Determine the native RISC OS filetype to export a content as.
Definition: filetype.c:263
int ro_content_filetype(struct hlcache_handle *h)
Determine the RISC OS filetype for a content.
Definition: filetype.c:243
High-level cache handle.
Definition: hlcache.c:66