| 1 | /* -*- mode: C; c-file-style: "gnu" -*- */ |
| 2 | /* xdgmimeglob.h: Private file. Datastructure for storing the globs. |
| 3 | * |
| 4 | * More info can be found at http://www.freedesktop.org/standards/ |
| 5 | * |
| 6 | * Copyright (C) 2003 Red Hat, Inc. |
| 7 | * Copyright (C) 2003 Jonathan Blandford <jrb@alum.mit.edu> |
| 8 | * |
| 9 | * Licensed under the Academic Free License version 2.0 |
| 10 | * Or under the following terms: |
| 11 | * |
| 12 | * This library is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU Lesser General Public |
| 14 | * License as published by the Free Software Foundation; either |
| 15 | * version 2 of the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This library is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 20 | * Lesser General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU Lesser General Public |
| 23 | * License along with this library; if not, write to the |
| 24 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 25 | * Boston, MA 02111-1307, USA. |
| 26 | */ |
| 27 | |
| 28 | #ifndef __XDG_MIME_GLOB_H__ |
| 29 | #define __XDG_MIME_GLOB_H__ |
| 30 | |
| 31 | #include "xdgmime.h" |
| 32 | |
| 33 | typedef struct XdgGlobHash XdgGlobHash; |
| 34 | |
| 35 | typedef enum |
| 36 | { |
| 37 | XDG_GLOB_LITERAL, /* Makefile */ |
| 38 | XDG_GLOB_SIMPLE, /* *.gif */ |
| 39 | XDG_GLOB_FULL /* x*.[ch] */ |
| 40 | } XdgGlobType; |
| 41 | |
| 42 | |
| 43 | #ifdef XDG_PREFIX |
| 44 | #define _xdg_mime_glob_read_from_file XDG_RESERVED_ENTRY(glob_read_from_file) |
| 45 | #define _xdg_glob_hash_new XDG_RESERVED_ENTRY(hash_new) |
| 46 | #define _xdg_glob_hash_free XDG_RESERVED_ENTRY(hash_free) |
| 47 | #define _xdg_glob_hash_lookup_file_name XDG_RESERVED_ENTRY(hash_lookup_file_name) |
| 48 | #define _xdg_glob_hash_get_simple_globs XDG_RESERVED_ENTRY(hash_get_simple_globs) |
| 49 | #define _xdg_glob_hash_append_glob XDG_RESERVED_ENTRY(hash_append_glob) |
| 50 | #define _xdg_glob_determine_type XDG_RESERVED_ENTRY(determine_type) |
| 51 | #define _xdg_glob_hash_dump XDG_RESERVED_ENTRY(hash_dump) |
| 52 | #endif |
| 53 | |
| 54 | void _xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash, |
| 55 | const char *file_name, |
| 56 | int version_two); |
| 57 | XdgGlobHash *_xdg_glob_hash_new (void); |
| 58 | void _xdg_glob_hash_free (XdgGlobHash *glob_hash); |
| 59 | int _xdg_glob_hash_lookup_file_name (XdgGlobHash *glob_hash, |
| 60 | const char *text, |
| 61 | const char *mime_types[], |
| 62 | int n_mime_types); |
| 63 | int _xdg_glob_hash_get_simple_globs (XdgGlobHash *glob_hash, |
| 64 | const char *mime, |
| 65 | char *globs[], |
| 66 | int n_globs); |
| 67 | void _xdg_glob_hash_append_glob (XdgGlobHash *glob_hash, |
| 68 | const char *glob, |
| 69 | const char *mime_type, |
| 70 | int weight, |
| 71 | int case_sensitive); |
| 72 | XdgGlobType _xdg_glob_determine_type (const char *glob); |
| 73 | void _xdg_glob_hash_dump (XdgGlobHash *glob_hash); |
| 74 | |
| 75 | #endif /* __XDG_MIME_GLOB_H__ */ |
| 76 | |