/********************************************************************** * * userdb.h -- functions to handle a language macro database * Copyright (C) 1999 DigiLib Systems Limited, New Zealand * * A component of the Greenstone digital library software * from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * *********************************************************************/ #ifndef LANGDB_H #define LANGDB_H #include "infodbclass.h" // these functions deal with language macro databases that are already open // they should have been opened with gdbmclass::opendatabase // as soon as the databases are finished with they should be closed with // gdbmclass::closedatabase so that another process can access the database // // some of the functions need the databases opened with write access, an // appropriate call would be something like: // // success = keydb.opendatabase (keyfile, GDBM_WRCREAT, 1000); // information about a single macro from a 'language'.dm file struct macroinfo_t { void clear (); macroinfo_t () {clear();} macroinfo_t &operator=(const macroinfo_t &x); text_t macroname; text_t macrotext; }; // functions dealing with language macro databases // returns true on success (in which case userinfo will contain // the information for this user) bool get_macro_info (gdbmclass &langdb, const text_t ¯oname, macroinfo_t ¯oinfo); bool get_macro_info (const text_t &langdbfile, const text_t ¯oname, macroinfo_t ¯oinfo); // returns true on success bool set_macro_info (gdbmclass &langdb, const text_t ¯oname, const macroinfo_t ¯oinfo); bool set_macro_info (const text_t &langdbfile, const text_t ¯oname, const macroinfo_t ¯oinfo); #endif