1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* xdgmimecache.h: Private file. Datastructure for mmapped caches.
3 *
4 * More info can be found at http://www.freedesktop.org/standards/
5 *
6 * Copyright (C) 2005 Matthias Clasen <mclasen@redhat.com>
7 *
8 * SPDX-License-Identifier: LGPL-2.1-or-later or AFL-2.0
9 */
10
11 #ifndef __XDG_MIME_CACHE_H__
12 #define __XDG_MIME_CACHE_H__
13
14 #include "xdgmime.h"
15
16 typedef struct _XdgMimeCache XdgMimeCache;
17
18 #ifdef XDG_PREFIX
19 #define _xdg_mime_cache_new_from_file XDG_RESERVED_ENTRY(cache_new_from_file)
20 #define _xdg_mime_cache_ref XDG_RESERVED_ENTRY(cache_ref)
21 #define _xdg_mime_cache_unref XDG_RESERVED_ENTRY(cache_unref)
22 #define _xdg_mime_cache_get_max_buffer_extents XDG_RESERVED_ENTRY(cache_get_max_buffer_extents)
23 #define _xdg_mime_cache_get_mime_type_for_data XDG_RESERVED_ENTRY(cache_get_mime_type_for_data)
24 #define _xdg_mime_cache_get_mime_type_for_file XDG_RESERVED_ENTRY(cache_get_mime_type_for_file)
25 #define _xdg_mime_cache_get_mime_type_from_file_name XDG_RESERVED_ENTRY(cache_get_mime_type_from_file_name)
26 #define _xdg_mime_cache_get_mime_types_from_file_name XDG_RESERVED_ENTRY(cache_get_mime_types_from_file_name)
27 #define _xdg_mime_cache_list_mime_parents XDG_RESERVED_ENTRY(cache_list_mime_parents)
28 #define _xdg_mime_cache_mime_type_subclass XDG_RESERVED_ENTRY(cache_mime_type_subclass)
29 #define _xdg_mime_cache_unalias_mime_type XDG_RESERVED_ENTRY(cache_unalias_mime_type)
30 #define _xdg_mime_cache_get_icon XDG_RESERVED_ENTRY(cache_get_icon)
31 #define _xdg_mime_cache_get_generic_icon XDG_RESERVED_ENTRY(cache_get_generic_icon)
32 #define _xdg_mime_cache_glob_dump XDG_RESERVED_ENTRY(cache_glob_dump)
33 #endif
34
35 extern XdgMimeCache **_caches;
36
37 XdgMimeCache *_xdg_mime_cache_new_from_file (const char *file_name);
38 XdgMimeCache *_xdg_mime_cache_ref (XdgMimeCache *cache);
39 void _xdg_mime_cache_unref (XdgMimeCache *cache);
40
41
42 const char *_xdg_mime_cache_get_mime_type_for_data (const void *data,
43 size_t len,
44 int *result_prio);
45 const char *_xdg_mime_cache_get_mime_type_for_file (const char *file_name,
46 struct stat *statbuf);
47 int _xdg_mime_cache_get_mime_types_from_file_name (const char *file_name,
48 const char *mime_types[],
49 int n_mime_types);
50 const char *_xdg_mime_cache_get_mime_type_from_file_name (const char *file_name);
51 int _xdg_mime_cache_is_valid_mime_type (const char *mime_type);
52 int _xdg_mime_cache_mime_type_equal (const char *mime_a,
53 const char *mime_b);
54 int _xdg_mime_cache_media_type_equal (const char *mime_a,
55 const char *mime_b);
56 int _xdg_mime_cache_mime_type_subclass (const char *mime_a,
57 const char *mime_b,
58 const char ***seen);
59 char **_xdg_mime_cache_list_mime_parents (const char *mime);
60 const char *_xdg_mime_cache_unalias_mime_type (const char *mime);
61 int _xdg_mime_cache_get_max_buffer_extents (void);
62 const char *_xdg_mime_cache_get_icon (const char *mime);
63 const char *_xdg_mime_cache_get_generic_icon (const char *mime);
64 void _xdg_mime_cache_glob_dump (void);
65
66 #endif /* __XDG_MIME_CACHE_H__ */