GnuCash c935c2f+
Loading...
Searching...
No Matches
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 gnu@gnu.org *
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
38#ifdef __cplusplus
39#include "gnc-backend-xml.h"
40#include "sixtp.h"
41#include <vector>
42
43class GncXmlBackend;
44
68#define GNC_FILE_BACKEND "gnc:file:2"
69#define GNC_FILE_BACKEND_VERS 2
70
77typedef struct
78{
79 AccountList* accts;
80 TransList* transactions;
81 QofBook* book;
82} gnc_template_xaction_data;
83
85gboolean qof_session_load_from_xml_file_v2 (GncXmlBackend*, QofBook*,
86 QofBookFileType);
87
88/* write all book info to a file */
89gboolean gnc_book_write_to_xml_filehandle_v2 (QofBook* book, FILE* fh);
90gboolean gnc_book_write_to_xml_file_v2 (QofBook* book, const char* filename,
91 gboolean compress);
92
94gboolean gnc_book_write_accounts_to_xml_filehandle_v2 (QofBackend* be,
95 QofBook* book, FILE* fh);
96gboolean gnc_book_write_accounts_to_xml_file_v2 (QofBackend* be, QofBook* book,
97 const char* filename);
98
102QofBookFileType gnc_is_xml_data_file_v2 (const gchar* name,
103 gboolean* with_encoding);
104
108gboolean gnc_xml2_write_namespace_decl (FILE* out, const char* name_space);
109
110extern "C"
111{
112#endif /* __cplusplus. The next two functions are used (only) by
113 * src/gnome-utils/assistant-xml-encoding.c and so need C linkage;
114 * they're also the only part of this file that the C compiler needs to
115 * see.
116 */
117
118typedef struct
119{
120 GQuark encoding;
121 gchar* utf8_string;
122} conv_type;
123
146 const gchar* filename, GList* encodings, GHashTable** unique,
147 GHashTable** ambiguous, GList** impossible);
148
155 GncXmlBackend* xml_be, QofBook* book, GHashTable* subst);
156#ifdef __cplusplus
157}
158typedef struct
159{
160 int version; /* backend version number */
161 const char * type_name; /* The XML tag for this type */
162
163 sixtp * (*create_parser) (void);
164 gboolean (*add_item)(sixtp_gdv2 *, gpointer obj);
165 int (*get_count) (QofBook *);
166 gboolean (*write) (FILE*, QofBook*);
167 void (*scrub) (QofBook *);
168 gboolean (*ns) (FILE*);
169} GncXmlDataType_t;
170
171void gnc_xml_register_backend(GncXmlDataType_t&);
172#endif /* __cplusplus */
173#endif /* __IO_GNCXML_V2_H__ */
load and save data to files
All type declarations for the whole Gnucash engine.
GList TransList
GList of Transaction.
Definition gnc-engine.h:209
GList AccountList
GList of Account.
Definition gnc-engine.h:203
gint gnc_xml2_find_ambiguous(const gchar *filename, GList *encodings, GHashTable **unique, GHashTable **ambiguous, GList **impossible)
Read a file as plain byte stream to find words that are not completely ASCII.
gboolean gnc_xml2_parse_with_subst(GncXmlBackend *xml_be, QofBook *book, GHashTable *subst)
Parse a file in push mode, but replace byte sequences in the file given a hash table of substitutions...
QofBook reference.
Definition qofbook-p.hpp:47
Definition sixtp.h:130