GnuCash 2.4.99
import-parse.h
00001 /*
00002  * import-parse.h -- a generic "parser" API for importers..  Allows importers
00003  *      to parse dates and numbers, and provides a UI to ask for users to
00004  *      resolve ambiguities.
00005  *
00006  * Created by:  Derek Atkins <derek@ihtfp.com>
00007  * Copyright (c) 2003 Derek Atkins <warlord@MIT.EDU>
00008  *
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU General Public License as
00011  * published by the Free Software Foundation; either version 2 of
00012  * the License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, contact:
00021  *
00022  * Free Software Foundation           Voice:  +1-617-542-5942
00023  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
00024  * Boston, MA  02110-1301,  USA       gnu@gnu.org
00025  */
00026 
00027 #ifndef IMPORT_PARSE_H
00028 #define IMPORT_PARSE_H
00029 
00030 #include "qof.h"
00031 
00032 typedef enum
00033 {
00034     GNCIF_NONE          = 0,
00035 
00036     /* number formats */
00037     GNCIF_NUM_PERIOD    = (1 << 1),
00038     GNCIF_NUM_COMMA     = (1 << 2),
00039 
00040     /* date formats */
00041     GNCIF_DATE_MDY      = (1 << 8),
00042     GNCIF_DATE_DMY      = (1 << 9),
00043     GNCIF_DATE_YMD      = (1 << 10),
00044     GNCIF_DATE_YDM      = (1 << 11)
00045 } GncImportFormat;
00046 
00047 
00048 GncImportFormat gnc_import_test_numeric(const char* str, GncImportFormat fmts);
00049 GncImportFormat gnc_import_test_date(const char* str, GncImportFormat fmts);
00050 
00051 
00052 GncImportFormat gnc_import_choose_fmt(const char* msg, GncImportFormat fmts,
00053                                       gpointer user_data);
00054 
00055 gboolean gnc_import_parse_numeric(const char* str, GncImportFormat fmt,
00056                                   gnc_numeric *val);
00057 gboolean gnc_import_parse_date(const char *date, GncImportFormat fmt,
00058                                Timespec *val);
00059 
00060 /* Set and clear flags in bit-flags */
00061 #define import_set_flag(i,f) (i |= f)
00062 #define import_clear_flag(i,f) (i &= ~f)
00063 
00064 
00065 #endif /* IMPORT_PARSE_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines