00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef QOF_DISABLE_DEPRECATED
00024
00025 #ifndef _DEPRECATED_H
00026 #define _DEPRECATED_H
00027 #include "qof.h"
00028
00034 #define gncLogLevel QofLogLevel
00035
00037 void gnc_log_init (void);
00038
00040 void gnc_set_log_level (QofLogModule module, gncLogLevel level);
00041
00043 void gnc_set_log_level_global (gncLogLevel level);
00044
00057 void qof_log_set_level_global (QofLogLevel level);
00058
00060 void gnc_set_logfile (FILE * outfile);
00061
00063 const char *gnc_log_prettify (const char *name);
00064
00066 gboolean gnc_should_log (QofLogModule log_module, gncLogLevel log_level);
00067
00069 #define GNC_LOG_FATAL QOF_LOG_FATAL
00070
00071 #define GNC_LOG_ERROR QOF_LOG_ERROR
00072
00073 #define GNC_LOG_WARNING QOF_LOG_WARNING
00074
00075 #define GNC_LOG_INFO QOF_LOG_INFO
00076
00077 #define GNC_LOG_DEBUG QOF_LOG_DEBUG
00078
00079 #define GNC_LOG_DETAIL QOF_LOG_DETAIL
00080
00081 #define GNC_LOG_TRACE QOF_LOG_TRACE
00082
00084 void gnc_start_clock (int, QofLogModule, gncLogLevel, const char *,
00085 const char *, ...);
00087 void gnc_report_clock (int, QofLogModule, gncLogLevel, const char *,
00088 const char *, ...);
00090 void gnc_report_clock_total (int, QofLogModule, gncLogLevel, const char *,
00091 const char *, ...);
00092
00094 #define GNC_EVENT_NONE QOF_EVENT_NONE
00095
00096 #define GNC_EVENT_CREATE QOF_EVENT_CREATE
00097
00098 #define GNC_EVENT_MODIFY QOF_EVENT_MODIFY
00099
00100 #define GNC_EVENT_DESTROY QOF_EVENT_DESTROY
00101
00102 #define GNC_EVENT_ADD QOF_EVENT_ADD
00103
00104 #define GNC_EVENT_REMOVE QOF_EVENT_REMOVE
00105
00106 #define GNC_EVENT_ALL QOF_EVENT_ALL
00107
00108 #define GNCEngineEventType QofEventId
00109
00110 typedef void (*GNCEngineEventHandler) (GUID * entity, QofIdType type,
00111 GNCEngineEventType event_type,
00112 gpointer user_data);
00116 gint qof_event_register_old_handler (GNCEngineEventHandler old_handler,
00117 gpointer user_data);
00119 gint gnc_engine_register_event_handler (GNCEngineEventHandler handler,
00120 gpointer user_data);
00122 void gnc_engine_unregister_event_handler (gint handler_id);
00124 void gnc_engine_gen_event (QofEntity * entity, GNCEngineEventType event_type);
00126 void gnc_engine_suspend_events (void);
00128 void gnc_engine_resume_events (void);
00130 void gnc_engine_generate_event (const GUID * guid, QofIdType e_type,
00131 GNCEngineEventType event_type);
00133 #define qof_book_mergeResult QofBookMergeResult
00134
00135 #define qof_book_mergeRule QofBookMergeRule
00136
00137 #define qof_book_mergeData QofBookMergeData
00138
00139 QofBookMergeData *qof_book_mergeInit (QofBook * importBook,
00140 QofBook * targetBook);
00142 typedef void (*qof_book_mergeRuleForeachCB) (QofBookMergeData *,
00143 QofBookMergeRule *, guint);
00145 void qof_book_mergeRuleForeach (QofBookMergeData * mergeData,
00146 QofBookMergeRuleForeachCB callback,
00147 QofBookMergeResult mergeResult);
00149 QofBookMergeData *qof_book_mergeUpdateResult (QofBookMergeData * mergeData,
00150 QofBookMergeResult tag);
00152 gint qof_book_mergeCommit (QofBookMergeData * mergeData);
00155 #define SAFE_STRCMP_REAL(fcn,da,db) { \
00156 if ((da) && (db)) { \
00157 if ((da) != (db)) { \
00158 gint retval = fcn ((da), (db)); \
00159 \
00160 if (retval) return retval; \
00161 } \
00162 } else \
00163 if ((!(da)) && (db)) { \
00164 return -1; \
00165 } else \
00166 if ((da) && (!(db))) { \
00167 return +1; \
00168 } \
00169 }
00170
00171 #define SAFE_STRCMP(da,db) SAFE_STRCMP_REAL(strcmp,(da),(db))
00172
00173 #define SAFE_STRCASECMP(da,db) SAFE_STRCMP_REAL(strcasecmp,(da),(db))
00174
00175 gpointer gnc_string_cache_insert (gconstpointer key);
00177 #define GNC_SCANF_LLD QOF_SCANF_LLD
00178
00179 gchar *gnc_stpcpy (gchar * dest, const gchar * src);
00181 GCache *gnc_engine_get_string_cache (void);
00183 GCache *qof_util_get_string_cache (void);
00185 void gnc_engine_string_cache_destroy (void);
00187 void gnc_string_cache_remove (gconstpointer key);
00189 void qof_book_set_schedxactions (QofBook * book, GList * newList);
00191 typedef enum
00192 {
00193 GNCDATE_MONTH_NUMBER,
00195 GNCDATE_MONTH_ABBREV,
00197 GNCDATE_MONTH_NAME
00198 } GNCDateMonthFormat;
00200 const gchar* gnc_date_dateformat_to_string(QofDateFormat format);
00202 const gchar* gnc_date_monthformat_to_string(GNCDateMonthFormat format);
00211 gboolean gnc_date_string_to_dateformat (const gchar * format_string,
00212 QofDateFormat * format);
00214 gboolean gnc_date_string_to_monthformat (const gchar * format_string,
00215 GNCDateMonthFormat * format);
00217
00218
00219
00220
00221
00223 gboolean timespec_equal (const Timespec * ta, const Timespec * tb);
00225 gint timespec_cmp (const Timespec * ta, const Timespec * tb);
00227 Timespec timespec_diff (const Timespec * ta, const Timespec * tb);
00229 Timespec timespec_abs (const Timespec * t);
00231 Timespec timespecCanonicalDayTime (Timespec t);
00233 time_t timespecToTime_t (Timespec ts);
00235 void timespecFromTime_t (Timespec * ts, time_t t);
00237 Timespec gnc_dmy2timespec (gint day, gint month, gint year);
00239 Timespec gnc_dmy2timespec_end (gint day, gint month, gint year);
00241 Timespec gnc_iso8601_to_timespec_gmt (const gchar *);
00243 gchar *gnc_timespec_to_iso8601_buff (Timespec ts, gchar * buff);
00245 void gnc_timespec2dmy (Timespec ts, gint * day, gint * month, gint * year);
00247 void date_add_months (struct tm *tm, gint months, gboolean track_last_day);
00248
00249
00250 gboolean qof_date_add_days(Timespec *ts, gint days);
00251
00252 gboolean qof_date_add_months(Timespec *ts, gint months, gboolean track_last_day);
00253
00254 const gchar *qof_date_format_get_string(QofDateFormat df);
00255
00256
00258 time_t xaccDMYToSec (gint day, gint month, gint year);
00260 glong gnc_timezone (struct tm *tm);
00262 QofDateFormat qof_date_format_get(void);
00264 void qof_date_format_set(QofDateFormat df);
00266 const gchar *qof_date_text_format_get_string(QofDateFormat df);
00268 char dateSeparator (void);
00271 time_t qof_date_dmy_to_sec (gint day, gint month, gint year);
00273 size_t qof_print_hours_elapsed_buff (char *buff, size_t len, int secs,
00274 gboolean show_secs);
00276 size_t qof_print_minutes_elapsed_buff (char *buff, size_t len, int secs,
00277 gboolean show_secs);
00279 size_t qof_print_time_buff (char *buff, size_t len, time_t secs);
00281 size_t qof_print_date_time_buff (char *buff, size_t len, time_t secs);
00283 gboolean qof_is_same_day (time_t, time_t);
00285 void gnc_tm_get_day_start (struct tm *tm, time_t time_val);
00287 void gnc_tm_set_day_start (struct tm *tm);
00289 void gnc_tm_set_day_middle (struct tm *tm);
00291 void gnc_tm_set_day_end (struct tm *tm);
00293 void gnc_tm_get_day_end (struct tm *tm, time_t time_val);
00295 time_t gnc_timet_get_day_start (time_t time_val);
00297 time_t gnc_timet_get_day_end (time_t time_val);
00299 void gnc_tm_get_today_start (struct tm *tm);
00301 void gnc_tm_get_today_end (struct tm *tm);
00303 time_t gnc_timet_get_today_start (void);
00305 time_t gnc_timet_get_today_end (void);
00306 #ifndef GNUCASH_MAJOR_VERSION
00307
00308 time_t gnc_timet_get_day_start_gdate (GDate * date);
00310 time_t gnc_timet_get_day_end_gdate (GDate * date);
00311 #endif
00312
00313 int date_get_last_mday (struct tm *tm);
00315 gboolean date_is_last_mday (struct tm *tm);
00317 int gnc_date_my_last_mday (int month, int year);
00319 int gnc_timespec_last_mday (Timespec ts);
00321 char * xaccDateUtilGetStampNow (void);
00323 char *xaccDateUtilGetStamp (time_t thyme);
00325 size_t qof_print_date_dmy_buff (gchar * buff, size_t buflen,
00326 gint day, gint month, gint year);
00328 size_t qof_print_date_buff (char *buff, size_t buflen, time_t secs);
00330 size_t qof_print_gdate (char *buf, size_t bufflen, GDate * gd);
00332 char *qof_print_date (time_t secs);
00334 const char *gnc_print_date (Timespec ts);
00336 gboolean qof_scan_date (const char *buff, int *day, int *month, int *year);
00338 gboolean qof_scan_date_secs (const char *buff, time_t * secs);
00341 #define qof_book_set_guid(book,guid) \
00342 qof_entity_set_guid(QOF_ENTITY(book), guid)
00343
00344 #define QOF_TYPE_DATE "date"
00345
00346 Timespec qof_instance_get_last_update (QofInstance * inst);
00347 void qof_instance_set_last_update (QofInstance * inst, Timespec ts);
00349 void kvp_frame_set_timespec (KvpFrame * frame, const gchar * path,
00350 Timespec ts);
00352 void kvp_frame_add_timespec (KvpFrame * frame, const gchar * path,
00353 Timespec ts);
00355 Timespec kvp_value_get_timespec (const KvpValue * value);
00357 Timespec kvp_frame_get_timespec (const KvpFrame * frame, const gchar * path);
00359 KvpValue *kvp_value_new_timespec (Timespec timespec);
00361 #define qof_book_get_guid(X) qof_entity_get_guid (QOF_ENTITY(X))
00362
00363 void qof_start_clock (gint clockno, QofLogModule log_module,
00364 QofLogLevel log_level, const gchar * function_name,
00365 const gchar * format, ...);
00367 void qof_report_clock (gint clockno,
00368 QofLogModule log_module,
00369 QofLogLevel log_level,
00370 const gchar * function_name,
00371 const gchar * format, ...);
00373 void qof_report_clock_total (gint clockno,
00374 QofLogModule log_module,
00375 QofLogLevel log_level,
00376 const gchar * function_name,
00377 const gchar * format, ...);
00379 #define START_CLOCK(clockno,format, args...) do { \
00380 if (qof_log_check (log_module, QOF_LOG_INFO)) \
00381 qof_start_clock (clockno, log_module, QOF_LOG_INFO, \
00382 __FUNCTION__, format , ## args); \
00383 } while (0)
00384
00385 #define REPORT_CLOCK(clockno,format, args...) do { \
00386 if (qof_log_check (log_module, QOF_LOG_INFO)) \
00387 qof_report_clock (clockno, log_module, QOF_LOG_INFO, \
00388 __FUNCTION__, format , ## args); \
00389 } while (0)
00390
00391 #define REPORT_CLOCK_TOTAL(clockno,format, args...) do { \
00392 if (qof_log_check (log_module, QOF_LOG_INFO)) \
00393 qof_report_clock_total (clockno, log_module, QOF_LOG_INFO, \
00394 __FUNCTION__, format , ## args); \
00395 } while (0)
00396
00398 void qof_query_print (QofQuery * query);
00400 typedef struct
00401 {
00402 QofQueryPredData pd;
00403 QofDateMatch options;
00404 Timespec date;
00405 } query_date_def, *query_date_t;
00407 QofQueryPredData *
00408 qof_query_date_predicate (QofQueryCompare how,
00409 QofDateMatch options,
00410 Timespec date);
00411 gboolean
00412 qof_query_date_predicate_get_date (QofQueryPredData * pd,
00413 Timespec * date);
00416 QofSession *qof_session_get_current_session (void);
00419 void qof_session_set_current_session (QofSession * session);
00422 void
00423 qof_session_clear_current_session (void);
00425 gboolean gnc_strisnum (const guchar * s);
00427 KvpFrame *
00428 gnc_kvp_bag_add (KvpFrame * pwd, const char *path,
00429 time_t secs, const char *first_name, ...);
00431 KvpFrame *
00432 gnc_kvp_bag_find_by_guid (KvpFrame * root, const char *path,
00433 const char *guid_name, GUID * desired_guid);
00435 void
00436 gnc_kvp_bag_remove_frame (KvpFrame * root, const char *path,
00437 KvpFrame * fr);
00439 void
00440 gnc_kvp_bag_merge (KvpFrame * kvp_into, const char *intopath,
00441 KvpFrame * kvp_from, const char *frompath);
00442
00443 #endif
00444 #endif