NetSurf
content_factory.h
Go to the documentation of this file.
1/*
2 * Copyright 2011 John-Mark Bell <jmb@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#ifndef NETSURF_CONTENT_CONTENT_FACTORY_H_
20#define NETSURF_CONTENT_CONTENT_FACTORY_H_
21
22#include <stdbool.h>
23
24#include <libwapcaplet/libwapcaplet.h>
25
27#include "utils/errors.h"
28
29#define CONTENT_FACTORY_REGISTER_TYPES(HNAME, HTYPELIST, HHANDLER) \
30 \
31nserror HNAME##_init(void) \
32{ \
33 uint32_t i; \
34 nserror error = NSERROR_OK; \
35 \
36 for (i = 0; i < NOF_ELEMENTS(HTYPELIST); i++) { \
37 error = content_factory_register_handler( \
38 HTYPELIST[i], \
39 &HHANDLER); \
40 if (error != NSERROR_OK) \
41 break; \
42 } \
43 \
44 return error; \
45}
46
47struct content;
48struct llcache_handle;
49struct content_handler;
50
51void content_factory_fini(void);
52
54 const struct content_handler *handler);
55
57 const char *fallback_charset, bool quirks,
58 lwc_string *effective_type);
59
61
62#endif
nserror content_factory_register_handler(const char *mime_type, const struct content_handler *handler)
content_type content_factory_type_from_mime_type(lwc_string *mime_type)
Compute the generic content type for a MIME type.
struct content * content_factory_create_content(struct llcache_handle *llcache, const char *fallback_charset, bool quirks, lwc_string *effective_type)
Create a content object.
void content_factory_fini(void)
Clean up after the content factory.
Declaration of content enumerations.
content_type
The type of a content.
Definition: content_type.h:53
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
static struct llcache_s * llcache
low level cache state
Definition: llcache.c:267
Content operation function table.
Content which corresponds to a single URL.
bool quirks
Content is in quirks mode.
lwc_string * mime_type
Original MIME type of data.
char * fallback_charset
Fallback charset, or NULL.
Handle to low-level cache object.
Definition: llcache.c:76