1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * userdb.h -- functions to handle a language macro database
|
---|
4 | * Copyright (C) 1999 DigiLib Systems Limited, New Zealand
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef LANGDB_H
|
---|
28 | #define LANGDB_H
|
---|
29 |
|
---|
30 | #include "infodbclass.h"
|
---|
31 |
|
---|
32 |
|
---|
33 | // these functions deal with language macro databases that are already open
|
---|
34 | // they should have been opened with gdbmclass::opendatabase
|
---|
35 | // as soon as the databases are finished with they should be closed with
|
---|
36 | // gdbmclass::closedatabase so that another process can access the database
|
---|
37 | //
|
---|
38 | // some of the functions need the databases opened with write access, an
|
---|
39 | // appropriate call would be something like:
|
---|
40 | //
|
---|
41 | // success = keydb.opendatabase (keyfile, GDBM_WRCREAT, 1000);
|
---|
42 |
|
---|
43 |
|
---|
44 | // information about a single macro from a 'language'.dm file
|
---|
45 | struct macroinfo_t {
|
---|
46 | void clear ();
|
---|
47 | macroinfo_t () {clear();}
|
---|
48 | macroinfo_t &operator=(const macroinfo_t &x);
|
---|
49 |
|
---|
50 | text_t macroname;
|
---|
51 | text_t macrotext;
|
---|
52 | };
|
---|
53 |
|
---|
54 | // functions dealing with language macro databases
|
---|
55 |
|
---|
56 | // returns true on success (in which case userinfo will contain
|
---|
57 | // the information for this user)
|
---|
58 | bool get_macro_info (gdbmclass &langdb, const text_t ¯oname,
|
---|
59 | macroinfo_t ¯oinfo);
|
---|
60 | bool get_macro_info (const text_t &langdbfile, const text_t ¯oname,
|
---|
61 | macroinfo_t ¯oinfo);
|
---|
62 |
|
---|
63 | // returns true on success
|
---|
64 | bool set_macro_info (gdbmclass &langdb, const text_t ¯oname,
|
---|
65 | const macroinfo_t ¯oinfo);
|
---|
66 | bool set_macro_info (const text_t &langdbfile, const text_t ¯oname,
|
---|
67 | const macroinfo_t ¯oinfo);
|
---|
68 |
|
---|
69 |
|
---|
70 | #endif
|
---|