2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
4 * Copyright (C) 2007-2009, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
5 * Copyright (C) 2014, Rob Norris <rw_norris@hotmail.com>
7 * Copyright (C) 2003-2007, Leandro A. F. Pereira <leandro@linuxmag.com.br>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef _VIKING_UTIL_H
26 #define _VIKING_UTIL_H
32 gchar *uri_escape(gchar *str);
34 GList * str_array_to_glist(gchar* data[]);
36 gboolean split_string_from_file_on_equals ( const gchar *buf, gchar **key, gchar **val );
38 void util_add_to_deletion_list ( const gchar* filename );
39 void util_remove_all_in_deletion_list ( void );
41 gchar *util_str_remove_chars(gchar *string, const gchar *chars);
43 /** Returns @c TRUE if @a ptr is @c NULL or @c *ptr is @c FALSE. */
47 /** Iterates all the nodes in @a list.
48 * @param node should be a (@c GList*).
49 * @param list @c GList to traverse. */
50 #define foreach_list(node, list) \
51 for (node = list; node != NULL; node = node->next)
53 /** Iterates all the nodes in @a list.
54 * @param node should be a (@c GSList*).
55 * @param list @c GSList to traverse. */
56 #define foreach_slist(node, list) \
57 foreach_list(node, list)
59 /** Iterates through each character in @a string.
60 * @param char_ptr Pointer to character.
61 * @param string String to traverse.
62 * @warning Doesn't include null terminating character. */
63 #define foreach_str(char_ptr, string) \
64 for (char_ptr = string; *char_ptr; char_ptr++)
66 int util_remove ( const gchar *filename );