|
GnuCash 2.4.99
|
00001 00002 /* xml-helpers.h 00003 * Miscellaneous bogus helper routines. 00004 */ 00005 00006 static inline void 00007 maybe_add_int (xmlNodePtr ptr, const char *tag, gint val) 00008 { 00009 if (val) 00010 xmlAddChild (ptr, int_to_dom_tree (tag, val)); 00011 } 00012 00013 static inline void 00014 maybe_add_numeric (xmlNodePtr ptr, const char *tag, gnc_numeric val) 00015 { 00016 if (!gnc_numeric_zero_p (val)) 00017 xmlAddChild (ptr, gnc_numeric_to_dom_tree (tag, &val)); 00018 } 00019 00020 static inline void 00021 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str) 00022 { 00023 if (str && strlen(str) > 0) 00024 xmlAddChild (ptr, text_to_dom_tree (tag, str)); 00025 } 00026 00027 static inline void 00028 maybe_add_guid (xmlNodePtr ptr, const char *tag, QofInstance *inst) 00029 { 00030 if (inst) 00031 xmlAddChild (ptr, guid_to_dom_tree (tag, 00032 qof_instance_get_guid (inst))); 00033 } 00034
1.7.4