Line data Source code
1 : /********************************************************************\
2 : * This program is free software; you can redistribute it and/or *
3 : * modify it under the terms of the GNU General Public License as *
4 : * published by the Free Software Foundation; either version 2 of *
5 : * the License, or (at your option) any later version. *
6 : * *
7 : * This program is distributed in the hope that it will be useful, *
8 : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
9 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
10 : * GNU General Public License for more details. *
11 : * *
12 : * You should have received a copy of the GNU General Public License*
13 : * along with this program; if not, contact: *
14 : * *
15 : * Free Software Foundation Voice: +1-617-542-5942 *
16 : * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
17 : * Boston, MA 02110-1301, USA gnu@gnu.org *
18 : * *
19 : \********************************************************************/
20 :
21 :
22 : /* xml-helpers.h
23 : * Miscellaneous bogus helper routines.
24 : */
25 :
26 : static inline void
27 0 : maybe_add_int (xmlNodePtr ptr, const char* tag, gint val)
28 : {
29 0 : if (val)
30 0 : xmlAddChild (ptr, int_to_dom_tree (tag, val));
31 0 : }
32 :
33 : static inline void
34 0 : maybe_add_numeric (xmlNodePtr ptr, const char* tag, gnc_numeric val)
35 : {
36 0 : if (!gnc_numeric_zero_p (val))
37 0 : xmlAddChild (ptr, gnc_numeric_to_dom_tree (tag, &val));
38 0 : }
39 :
40 : static inline void
41 2 : maybe_add_string (xmlNodePtr ptr, const char* tag, const char* str)
42 : {
43 2 : if (str && *str)
44 0 : xmlAddChild (ptr, text_to_dom_tree (tag, str));
45 2 : }
46 :
47 : static inline void
48 0 : maybe_add_guid (xmlNodePtr ptr, const char* tag, QofInstance* inst)
49 : {
50 0 : if (inst)
51 0 : xmlAddChild (ptr, guid_to_dom_tree (tag,
52 : qof_instance_get_guid (inst)));
53 0 : }
54 :
|