GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
io-gncxml-v2.h
Go to the documentation of this file.
1 /********************************************************************\
2  * io-gncxml-v2.h -- api for gnucash xml i/o *
3  * *
4  * Copyright (c) 2001 Gnumatic Incorporated *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License*
17  * along with this program; if not, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA [email protected] *
22  * *
23 \********************************************************************/
24 
31 #ifndef IO_GNCXML_V2_H
32 #define IO_GNCXML_V2_H
33 
34 #include <glib.h>
35 
36 #include "gnc-engine.h"
37 #include "gnc-backend-xml.h"
38 
39 #include "sixtp.h"
40 
41 typedef struct
42 {
43  int accounts_total;
44  int accounts_loaded;
45 
46  int books_total;
47  int books_loaded;
48 
49  int commodities_total;
50  int commodities_loaded;
51 
52  int transactions_total;
53  int transactions_loaded;
54 
55  int prices_total;
56  int prices_loaded;
57 
58  int schedXactions_total;
59  int schedXactions_loaded;
60 
61  int budgets_total;
62  int budgets_loaded;
63 } load_counter;
64 
65 typedef struct sixtp_gdv2 sixtp_gdv2;
66 typedef void (*countCallbackFn)(sixtp_gdv2 *gd, const char *type);
67 struct sixtp_gdv2
68 {
69  QofBook *book;
70  load_counter counter;
71  countCallbackFn countCallback;
72  QofBePercentageFunc gui_display_fn;
73  gboolean exporting;
74 };
75 
99 #define GNC_FILE_BACKEND "gnc:file:2"
100 #define GNC_FILE_BACKEND_VERS 2
101 typedef struct
102 {
103  int version; /* backend version number */
104  const char * type_name; /* The XML tag for this type */
105 
106  sixtp * (*create_parser) (void);
107  gboolean (*add_item)(sixtp_gdv2 *, gpointer obj);
108  int (*get_count) (QofBook *);
109  gboolean (*write) (FILE*, QofBook*);
110  void (*scrub) (QofBook *);
111  gboolean (*ns) (FILE*);
113 
120 typedef struct
121 {
122  AccountList *accts;
123  TransList *transactions;
124  QofBook *book;
126 
128 void run_callback(sixtp_gdv2 *data, const char *type);
129 
131 gboolean qof_session_load_from_xml_file_v2(FileBackend *, QofBook *, QofBookFileType);
132 
133 /* write all book info to a file */
134 gboolean gnc_book_write_to_xml_filehandle_v2(QofBook *book, FILE *fh);
135 gboolean gnc_book_write_to_xml_file_v2(QofBook *book, const char *filename, gboolean compress);
136 
139 gboolean gnc_book_write_accounts_to_xml_file_v2(QofBackend * be, QofBook *book,
140  const char *filename);
141 
145 QofBookFileType gnc_is_xml_data_file_v2(const gchar *name, gboolean *with_encoding);
146 
150 gboolean gnc_xml2_write_namespace_decl (FILE *out, const char *name_space);
151 
152 
153 typedef struct
154 {
155  GQuark encoding;
156  gchar *utf8_string;
157 } conv_type;
158 
181  const gchar *filename, GList *encodings, GHashTable **unique,
182  GHashTable **ambiguous, GList **impossible);
183 
189 gboolean gnc_xml2_parse_with_subst (
190  FileBackend *fbe, QofBook *book, GHashTable *subst);
191 
192 #endif /* __IO_GNCXML_V2_H__ */
GList TransList
Definition: gnc-engine.h:205
gboolean qof_session_load_from_xml_file_v2(FileBackend *, QofBook *, QofBookFileType)
Definition: io-gncxml-v2.c:865
Definition: sixtp.h:93
gboolean gnc_book_write_accounts_to_xml_filehandle_v2(QofBackend *be, QofBook *book, FILE *fh)
gboolean gnc_xml2_parse_with_subst(FileBackend *fbe, QofBook *book, GHashTable *subst)
void(* QofBePercentageFunc)(const char *message, double percent)
DOCUMENT ME!
Definition: qofbackend.h:150
QofBookFileType gnc_is_xml_data_file_v2(const gchar *name, gboolean *with_encoding)
All type declarations for the whole Gnucash engine.
GList AccountList
Definition: gnc-engine.h:199
gint gnc_xml2_find_ambiguous(const gchar *filename, GList *encodings, GHashTable **unique, GHashTable **ambiguous, GList **impossible)
gboolean gnc_xml2_write_namespace_decl(FILE *out, const char *name_space)
load and save data to files
void run_callback(sixtp_gdv2 *data, const char *type)
Definition: io-gncxml-v2.c:109