Add:Core:First try to add a general purpose cache to navit
[navit-package] / navit / file.h
1 /**
2  * Navit, a modular navigation system.
3  * Copyright (C) 2005-2008 Navit Team
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public License
7  * version 2 as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef NAVIT_FILE_H
21 #define NAVIT_FILE_H
22
23 #include "param.h"
24
25 struct file {
26         unsigned char *begin;
27         unsigned char *end;
28         long long size;
29         char *name;
30         int name_id;
31         int fd;
32 #if defined(_WIN32) || defined(__CEGCC__)
33     long map_handle;
34     long map_file;
35 #endif
36         struct file *next;
37 };
38
39 /* prototypes */
40 struct file;
41 struct file_wordexp;
42 struct param_list;
43 struct file *file_create(char *name);
44 int file_is_dir(char *name);
45 int file_mkdir(char *name, int pflag);
46 int file_mmap(struct file *file);
47 unsigned char *file_data_read(struct file *file, long long offset, int size);
48 unsigned char *file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp);
49 void file_data_free(struct file *file, unsigned char *data);
50 int file_exists(char *name);
51 void file_remap_readonly(struct file *f);
52 void file_remap_readonly_all(void);
53 void file_unmap(struct file *f);
54 void file_unmap_all(void);
55 void *file_opendir(char *dir);
56 char *file_readdir(void *hnd);
57 void file_closedir(void *hnd);
58 struct file *file_create_caseinsensitive(char *name);
59 void file_destroy(struct file *f);
60 struct file_wordexp *file_wordexp_new(const char *pattern);
61 int file_wordexp_get_count(struct file_wordexp *wexp);
62 char **file_wordexp_get_array(struct file_wordexp *wexp);
63 void file_wordexp_destroy(struct file_wordexp *wexp);
64 int file_get_param(struct file *file, struct param_list *param, int count);
65 /* end of prototypes */
66
67 #endif
68