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 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 General Public License for more details.
|
13 |
*
|
14 |
* You should have received a copy of the GNU General Public License
|
15 |
* 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 |
#include <glib.h>
|
21 |
#include "debug.h"
|
22 |
#include "projection.h"
|
23 |
#include "item.h"
|
24 |
#include "map.h"
|
25 |
#include "maptype.h"
|
26 |
|
27 |
static struct maptype *maptype_root;
|
28 |
|
29 |
void
|
30 |
maptype_register(char *name, struct map_priv *(*map_new)(struct map_methods *meth, char *data, char **charset, enum projection *pro))
|
31 |
{
|
32 |
struct maptype *mt;
|
33 |
mt=g_new(struct maptype, 1);
|
34 |
mt->name=g_strdup(name);
|
35 |
mt->map_new=map_new;
|
36 |
mt->next=maptype_root;
|
37 |
maptype_root=mt;
|
38 |
}
|
39 |
|
40 |
struct maptype *
|
41 |
maptype_get(const char *name)
|
42 |
{
|
43 |
struct maptype *mt=maptype_root;
|
44 |
|
45 |
while (mt) {
|
46 |
if (!g_ascii_strcasecmp(mt->name, name))
|
47 |
return mt;
|
48 |
mt=mt->next;
|
49 |
}
|
50 |
return NULL;
|
51 |
}
|