1 /*  Copyright (c) 2003-2014 Xfce Development Team
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __WEATHER_DEBUG_H__
20 #define __WEATHER_DEBUG_H__
21 
22 #include <glib.h>
23 #include <stdarg.h>
24 
25 #include "weather-parsers.h"
26 #include "weather-data.h"
27 #include "weather-icon.h"
28 #include "weather.h"
29 
30 G_BEGIN_DECLS
31 
32 #if __STDC_VERSION__ < 199901L
33 #if __GNUC__ >= 2
34 #define __func__ __FUNCTION__
35 #else
36 #define __func__ "<unknown>"
37 #endif
38 #endif
39 
40 #define weather_debug(...)                                  \
41     weather_debug_real(G_LOG_DOMAIN, __FILE__, __func__,    \
42                        __LINE__, __VA_ARGS__)
43 
44 #define weather_dump(func, data)                \
45     if (G_UNLIKELY(debug_mode)) {               \
46         gchar *dump_msg = func(data);                \
47         weather_debug("%s", dump_msg);               \
48         g_free(dump_msg);                            \
49     }
50 
51 void weather_debug_init(const gchar *log_domain,
52                         gboolean debug_mode);
53 
54 void weather_debug_real(const gchar *log_domain,
55                         const gchar *file,
56                         const gchar *func,
57                         gint line,
58                         const gchar *format,
59                         ...);
60 
61 gchar *weather_dump_geolocation(const xml_geolocation *geo);
62 
63 gchar *weather_dump_place(const xml_place *place);
64 
65 gchar *weather_dump_timezone(const xml_timezone *timezone);
66 
67 gchar *weather_dump_icon_theme(const icon_theme *theme);
68 
69 gchar *weather_dump_astrodata(const GArray *astrodata);
70 
71 gchar *weather_dump_astro(const xml_astro *astro);
72 
73 gchar *weather_dump_units_config(const units_config *units);
74 
75 gchar *weather_dump_timeslice(const xml_time *timeslice);
76 
77 gchar *weather_dump_weatherdata(const xml_weather *wd);
78 
79 gchar *weather_dump_plugindata(const plugin_data *data);
80 
81 G_END_DECLS
82 
83 #endif
84