45 # define QOF_SCANF_LLD "%lld"
47 # define QOF_SCANF_LLD "%qd"
50 #define QOF_MOD_UTIL "qof-utilities"
55 #define ENUM_BODY(name, value) \
58 #define AS_STRING_CASE(name, value) \
59 case name: { return #name; }
61 #define FROM_STRING_CASE(name, value) \
62 if (strcmp(str, #name) == 0) { \
65 #define DEFINE_ENUM(name, list) \
70 #define AS_STRING_DEC(name, list) \
71 const gchar* name##asString(name n);
73 #define AS_STRING_FUNC(name, list) \
74 const gchar* name##asString(name n) { \
76 list(AS_STRING_CASE) \
77 default: return ""; } }
79 #define FROM_STRING_DEC(name, list) \
80 name name##fromString \
83 #define FROM_STRING_FUNC(name, list) \
84 name name##fromString \
85 (const gchar* str) { \
86 if(str == NULL) { return 0; } \
87 list(FROM_STRING_CASE) \
105 #define DEFINE_ENUM_NON_TYPEDEF(name, list) \
110 #define FROM_STRING_DEC_NON_TYPEDEF(name, list) \
111 void name##fromString \
112 (const gchar* str, enum name *type);
114 #define FROM_STRING_CASE_NON_TYPEDEF(name, value) \
115 if (strcmp(str, #name) == 0) { *type = name; }
117 #define FROM_STRING_FUNC_NON_TYPEDEF(name, list) \
118 void name##fromString \
119 (const gchar* str, enum name *type) { \
120 if(str == NULL) { return; } \
121 list(FROM_STRING_CASE_NON_TYPEDEF) }
123 #define AS_STRING_DEC_NON_TYPEDEF(name, list) \
124 const gchar* name##asString(enum name n);
126 #define AS_STRING_FUNC_NON_TYPEDEF(name, list) \
127 const gchar* name##asString(enum name n) { \
129 list(AS_STRING_CASE_NON_TYPEDEF) \
130 default: return ""; } }
132 #define AS_STRING_CASE_NON_TYPEDEF(name, value) \
133 case name: { return #name; }
173 gint
safe_strcmp (
const gchar * da,
const gchar * db);
193 gint
null_strcmp (
const gchar * da,
const gchar * db);
198 extern gchar *
strncasestr (
const guchar * str1,
const guchar * str2,
201 extern gchar *strcasestr (
const gchar * str1,
const gchar * str2);
206 gchar *
ultostr (gulong val, gint base);
218 #define stpcpy g_stpcpy
264 const gchar * value_string);
320 #define CACHE_INSERT(str) qof_util_string_cache_insert((gconstpointer)(str))
321 #define CACHE_REMOVE(str) qof_util_string_cache_remove((str))
330 #define CACHE_REPLACE(dst, src) do { \
331 gpointer tmp = CACHE_INSERT((src)); \
332 CACHE_REMOVE((dst)); \
336 #define QOF_CACHE_NEW(void) qof_util_string_cache_insert("")