~ubuntu-branches/ubuntu/trusty/pcmanfm/trusty-proposed

« back to all changes in this revision

Viewing changes to src/mime-type/mime-cache.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Lee
  • Date: 2008-09-26 10:19:20 UTC
  • mfrom: (4.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080926101920-cfldybkmwgwrtv9u
Tags: 0.5-3
* Correct spellings,  03_correct_spelling.dpatch (Closes:498794) 
* Code in some files are taken from other projects, added these
  informations into copyright file. (Closes:499678)
* Applied 04_defaut_terminal.dpatch to support x-terminal-emulator
  alternative. (Closes:497494) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      mime-cache.h
 
3
 *
 
4
 *      Copyright 2007 PCMan <pcman.tw@gmail.com>
 
5
 *
 
6
 *      This program 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; either version 2 of the License, or
 
9
 *      (at your option) any later version.
 
10
 *
 
11
 *      This program is distributed in the hope that it will be useful,
 
12
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *      GNU General Public License for more details.
 
15
 *
 
16
 *      You should have received a copy of the GNU General Public License
 
17
 *      along with this program; if not, write to the Free Software
 
18
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
19
 *      MA 02110-1301, USA.
 
20
 */
 
21
 
 
22
#ifndef _MIME_CACHE_H_INCLUDED_
 
23
#define _MIME_CACHE_H_INCLUDED_
 
24
 
 
25
#include <sys/stat.h>
 
26
#include <sys/types.h>
 
27
#include <glib.h>
 
28
 
 
29
G_BEGIN_DECLS
 
30
 
 
31
struct _MimeCache
 
32
{
 
33
    char* file_path;
 
34
    gboolean has_reverse_suffix : 1; /* since mime.cache v1.1, shared mime info v0.4 */
 
35
    gboolean has_str_weight : 1; /* since mime.cache v1.1, shared mime info v0.4 */
 
36
    const char* buffer;
 
37
    guint size;
 
38
 
 
39
    guint32 n_alias;
 
40
    const char* alias;
 
41
 
 
42
    guint32 n_parents;
 
43
    const char* parents;
 
44
 
 
45
    guint32 n_literals;
 
46
    const char* literals;
 
47
 
 
48
    guint32 n_globs;
 
49
    const char* globs;
 
50
 
 
51
    guint32 n_suffix_roots;
 
52
    const char* suffix_roots;
 
53
 
 
54
    guint32 n_magics;
 
55
    guint32 magic_max_extent;
 
56
    const char* magics;
 
57
};
 
58
typedef struct _MimeCache MimeCache;
 
59
 
 
60
MimeCache* mime_cache_new( const char* file_path );
 
61
gboolean mime_cache_load( MimeCache* cache, const char* file_path );
 
62
gboolean mime_cache_reload( MimeCache* cache );
 
63
void mime_cache_free( MimeCache* cache );
 
64
 
 
65
const char* mime_cache_lookup_literal( MimeCache* cache, const char* filename );
 
66
const char* mime_cache_lookup_glob( MimeCache* cache, const char* filename, int *glob_len );
 
67
const char* mime_cache_lookup_suffix( MimeCache* cache, const char* filename, const char** suffix_pos );
 
68
const char* mime_cache_lookup_magic( MimeCache* cache, const char* data, int len );
 
69
const char** mime_cache_lookup_parents( MimeCache* cache, const char* mime_type );
 
70
const char* mime_cache_lookup_alias( MimeCache* cache, const char* mime_type );
 
71
 
 
72
G_END_DECLS
 
73
#endif