1 /* saxdb.h - srvx database manager
2 * Copyright 2002-2004 srvx Development Team
4 * This file is part of srvx.
6 * srvx is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 #define SAXDB_READER(NAME) int NAME(struct dict *db)
30 typedef SAXDB_READER(saxdb_reader_func_t);
32 #define SAXDB_WRITER(NAME) int NAME(struct saxdb_context *ctx)
33 typedef SAXDB_WRITER(saxdb_writer_func_t);
35 void saxdb_init(void);
36 void saxdb_finalize(void);
37 struct saxdb *saxdb_register(const char *name, saxdb_reader_func_t *reader, saxdb_writer_func_t *writer);
38 void saxdb_write(const char *db_name);
39 void saxdb_write_all(void);
40 int write_database(FILE *out, struct dict *db);
42 /* Callbacks for SAXDB_WRITERs */
43 void saxdb_start_record(struct saxdb_context *dest, const char *name, int complex);
44 void saxdb_end_record(struct saxdb_context *dest);
45 void saxdb_write_string_list(struct saxdb_context *dest, const char *name, struct string_list *list);
46 void saxdb_write_string(struct saxdb_context *dest, const char *name, const char *value);
47 void saxdb_write_int(struct saxdb_context *dest, const char *name, unsigned long value);
49 /* For doing db writing by hand */
50 struct saxdb_context *saxdb_open_context(FILE *f);
51 void saxdb_close_context(struct saxdb_context *ctx);
53 #endif /* !defined(DBMGR_H) */