NetSurf
Macros | Functions
content_factory.h File Reference
#include <stdbool.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/content_type.h"
#include "utils/errors.h"
Include dependency graph for content_factory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CONTENT_FACTORY_REGISTER_TYPES(HNAME, HTYPELIST, HHANDLER)
 

Functions

void content_factory_fini (void)
 Clean up after the content factory. More...
 
nserror content_factory_register_handler (const char *mime_type, const struct content_handler *handler)
 
struct contentcontent_factory_create_content (struct llcache_handle *llcache, const char *fallback_charset, bool quirks, lwc_string *effective_type)
 Create a content object. More...
 
content_type content_factory_type_from_mime_type (lwc_string *mime_type)
 Compute the generic content type for a MIME type. More...
 

Macro Definition Documentation

◆ CONTENT_FACTORY_REGISTER_TYPES

#define CONTENT_FACTORY_REGISTER_TYPES (   HNAME,
  HTYPELIST,
  HHANDLER 
)
Value:
\
nserror HNAME##_init(void) \
{ \
uint32_t i; \
nserror error = NSERROR_OK; \
\
for (i = 0; i < NOF_ELEMENTS(HTYPELIST); i++) { \
HTYPELIST[i], \
&HHANDLER); \
if (error != NSERROR_OK) \
break; \
} \
\
return error; \
}
nserror content_factory_register_handler(const char *mime_type, const struct content_handler *handler)
@ NSERROR_OK
No error.
Definition: errors.h:30
#define NOF_ELEMENTS(array)
Definition: search.c:67

Definition at line 29 of file content_factory.h.

Function Documentation

◆ content_factory_create_content()

struct content * content_factory_create_content ( llcache_handle llcache,
const char *  fallback_charset,
bool  quirks,
lwc_string *  effective_type 
)

Create a content object.

Parameters
llcacheUnderlying source data handle
fallback_charsetCharacter set to fall back to if none specified
quirksQuirkiness of containing document
effective_typeEffective MIME type of content
Returns
Pointer to content object, or NULL on failure

Definition at line 169 of file content_factory.c.

References content_lookup(), content_handler::create, content::fallback_charset, content::handler, http_content_type_destroy(), http_parse_content_type(), llcache, llcache_handle_get_header(), NSERROR_OK, http_content_type::parameters, and content::quirks.

Referenced by hlcache_find_content().

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

◆ content_factory_fini()

void content_factory_fini ( void  )

Clean up after the content factory.

Definition at line 53 of file content_factory.c.

References content_handlers, content_handler::fini, content_handler_entry::handler, content_handler_entry::mime_type, and content_handler_entry::next.

Referenced by netsurf_exit().

Here is the caller graph for this function:

◆ content_factory_register_handler()

nserror content_factory_register_handler ( const char *  mime_type,
const struct content_handler handler 
)

◆ content_factory_type_from_mime_type()

content_type content_factory_type_from_mime_type ( lwc_string *  mime_type)

Compute the generic content type for a MIME type.

Parameters
mime_typeMIME type to consider
Returns
Generic content type

Definition at line 147 of file content_factory.c.

References content_lookup(), CONTENT_NONE, content_handler_entry::handler, content_handler_entry::mime_type, content_handler::type, and type.

Referenced by ami_file_set_type(), box_object(), exec_inline_script(), hlcache_type_is_acceptable(), HOOKF(), and mimesniff_compute_effective_type().

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