storage.h
上传用户:tany51
上传日期:2013-06-12
资源大小:1397k
文件大小:2k
- /*
- * Copyright (C) 2002,2003 Mihai RUSU (dizzy@roedu.net)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
- #ifndef INCLUDED_STORAGE_TYPES
- #define INCLUDED_STORAGE_TYPES
- #ifndef JUST_NEED_TYPES
- #define JUST_NEED_TYPES
- #include "storage_file.h"
- #ifdef WITH_SQL
- #include "storage_sql.h"
- #endif
- #undef JUST_NEED_TYPES
- #else
- #include "storage_file.h"
- #ifdef WITH_SQL
- #include "storage_sql.h"
- #endif
- #endif
- #define t_storage_info void
- typedef int (*t_read_attr_func)(const char *, const char *, void *);
- typedef int (*t_read_accounts_func)(t_storage_info *, void*);
- typedef void * (*t_read_account_func)(t_storage_info *);
- typedef int (*t_load_clans_func)(void*);
- typedef struct {
- int (*init)(const char *);
- int (*close)(void);
- t_storage_info * (*create_account)(char const * );
- t_storage_info * (*get_defacct)(void);
- int (*free_info)(t_storage_info *);
- int (*read_attrs)(t_storage_info *, t_read_attr_func, void *);
- int (*write_attrs)(t_storage_info *, void *);
- void * (*read_attr)(t_storage_info *, const char *);
- int (*read_accounts)(t_read_accounts_func, void *);
- void * (*read_account)(t_read_account_func, const char *);
- int (*cmp_info)(t_storage_info *, t_storage_info *);
- const char * (*escape_key)(const char *);
- int (*load_clans)(t_load_clans_func);
- int (*write_clan)(void *);
- int (*remove_clan)(int);
- int (*remove_clanmember)(int);
- } t_storage;
- #endif /* INCLUDED_STORAGE_TYPES */
- #ifndef JUST_NEED_TYPES
- #ifndef INCLUDED_STORAGE_PROTOS
- #define INCLUDED_STORAGE_PROTOS
- extern t_storage *storage;
- extern int storage_init(const char *);
- extern void storage_close(void);
- #endif /* INCLUDED_STORAGE_PROTOS */
- #endif /* JUST_NEED_TYPES */