]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * viking -- GPS Data and Topo Analyzer, Explorer, and Manager | |
3 | * | |
4 | * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net> | |
5 | * Copyright (C) 2005, Alex Foobarian <foobarian@gmail.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | * | |
21 | */ | |
22 | ||
23 | #ifndef _VIKING_BABEL_H | |
24 | #define _VIKING_BABEL_H | |
25 | ||
26 | #include <glib.h> | |
27 | ||
28 | #include "viktrwlayer.h" | |
29 | ||
30 | typedef enum { | |
31 | BABEL_DIAG_OUTPUT, | |
32 | BABEL_DONE, | |
33 | } BabelProgressCode; | |
34 | ||
35 | typedef void (*BabelStatusFunc)(BabelProgressCode, gpointer, gpointer); | |
36 | ||
37 | /* | |
38 | * a_babel_convert modifies data in a trw layer using gpsbabel filters. This routine is synchronous; | |
39 | * that is, it will block the calling program until the conversion is done. To avoid blocking, call | |
40 | * this routine from a worker thread. The arguments are as follows: | |
41 | * | |
42 | * vt The TRW layer to modify. All data will be deleted, and replaced by what gpsbabel outputs. | |
43 | * | |
44 | * babelargs A string containing gpsbabel command line filter options. No file types or names should | |
45 | * be specified. | |
46 | * | |
47 | * cb A callback function, called with the following status codes: | |
48 | * BABEL_DIAG_OUTPUT: a line of diagnostic output is available. The pointer is to a | |
49 | * NUL-terminated line of diagnostic output from gpsbabel. | |
50 | * BABEL_DIAG_DONE: gpsbabel finished, | |
51 | * or NULL if no callback is needed. | |
52 | */ | |
53 | int a_babel_convert( VikTrwLayer *vt, const char *babelargs, BabelStatusFunc cb, gpointer user_data ); | |
54 | ||
55 | /* | |
56 | * a_babel_convert_from loads data into a trw layer from a file, using gpsbabel. This routine is synchronous; | |
57 | * that is, it will block the calling program until the conversion is done. To avoid blocking, call | |
58 | * this routine from a worker thread. The arguments are as follows: | |
59 | * | |
60 | * vt The TRW layer to place data into. Duplicate items will be overwritten. | |
61 | * | |
62 | * babelargs A string containing gpsbabel command line options. In addition to any filters, this string | |
63 | * must include the input file type (-i) option. | |
64 | * | |
65 | * cb Optional callback function. Same usage as in a_babel_convert. | |
66 | */ | |
67 | int a_babel_convert_from( VikTrwLayer *vt, const char *babelargs, BabelStatusFunc cb, const char *file, gpointer user_data ); | |
68 | gboolean a_babel_convert_from_shellcommand ( VikTrwLayer *vt, const char *input_cmd, const char *input_file_type, BabelStatusFunc cb, gpointer user_data ); | |
69 | gboolean a_babel_convert_from_url ( VikTrwLayer *vt, const char *url, const char *input_type, BabelStatusFunc cb, gpointer user_data ); | |
70 | int a_babel_convert_to( VikTrwLayer *vt, const char *babelargs, BabelStatusFunc cb, const char *file, gpointer user_data ); | |
71 | ||
72 | ||
73 | #endif |