]> jfr.im git - irc/evilnet/x3.git/blame - src/saxdb.h
Couple of srvx updates.
[irc/evilnet/x3.git] / src / saxdb.h
CommitLineData
d76ed9a9 1/* saxdb.h - srvx database manager
2 * Copyright 2002-2004 srvx Development Team
3 *
83ff05c3 4 * This file is part of x3.
d76ed9a9 5 *
d0f04f71 6 * x3 is free software; you can redistribute it and/or modify
d76ed9a9 7 * it under the terms of the GNU General Public License as published by
348683aa 8 * the Free Software Foundation; either version 3 of the License, or
d76ed9a9 9 * (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 srvx; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 */
20
21#if !defined(DBMGR_H)
22#define DBMGR_H
23
24#include "recdb.h"
25
26DECLARE_LIST(int_list, int);
27
28struct saxdb;
1136f709 29struct saxdb_context;
d76ed9a9 30
31#define SAXDB_READER(NAME) int NAME(struct dict *db)
32typedef SAXDB_READER(saxdb_reader_func_t);
33
34#define SAXDB_WRITER(NAME) int NAME(struct saxdb_context *ctx)
35typedef SAXDB_WRITER(saxdb_writer_func_t);
36
37void saxdb_init(void);
38void saxdb_finalize(void);
39struct saxdb *saxdb_register(const char *name, saxdb_reader_func_t *reader, saxdb_writer_func_t *writer);
40void saxdb_write(const char *db_name);
30874d66 41void saxdb_write_all(void* extra);
d76ed9a9 42int write_database(FILE *out, struct dict *db);
43
44/* Callbacks for SAXDB_WRITERs */
45void saxdb_start_record(struct saxdb_context *dest, const char *name, int complex);
46void saxdb_end_record(struct saxdb_context *dest);
47void saxdb_write_string_list(struct saxdb_context *dest, const char *name, struct string_list *list);
48void saxdb_write_string(struct saxdb_context *dest, const char *name, const char *value);
49void saxdb_write_int(struct saxdb_context *dest, const char *name, unsigned long value);
1136f709 50void saxdb_write_sint(struct saxdb_context *dest, const char *name, long value);
d76ed9a9 51
52/* For doing db writing by hand */
53struct saxdb_context *saxdb_open_context(FILE *f);
1136f709 54void saxdb_close_context(struct saxdb_context *ctx, int close_file);
55jmp_buf *saxdb_jmp_buf(struct saxdb_context *ctx);
d76ed9a9 56
57#endif /* !defined(DBMGR_H) */