source: main/trunk/greenstone2/runtime-src/src/colservr/maptools.h@ 27065

Last change on this file since 27065 was 9929, checked in by kjdon, 19 years ago

modifications so that collectionmeta are read from the config file, not from the gdbm database, therefore they will update without rebuilding

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/**********************************************************************
2 *
3 * maptools.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
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 MAPTOOLS_H
28#define MAPTOOLS_H
29
30
31#include "gsdlconf.h"
32#include "text_t.h"
33
34// stringmap is a mapping which remembers the original order
35// of the map, but is very fast to look up.
36class stringmap {
37protected:
38 text_tarray fromorder;
39 text_tmap mapfrom;
40
41public:
42 void clear ();
43
44 void importmap (const text_tarray &maparray);
45 void importmap (const text_tarray &maparray, bool keepold);
46 void exportmap (text_tarray &maparray) const;
47
48 void getfromarray (text_tarray &fromarray) const;
49 void gettoarray (text_tarray &toarray) const;
50
51 bool fromexists (const text_t &from) const;
52 bool toexists (const text_t &to) const;
53
54 // from2to and to2from return false if the key (the "from"
55 // field or the "to" field) cannot be found
56 bool from2to (const text_t &from, text_t &to) const;
57 bool to2from (const text_t &to, text_t &from) const;
58};
59
60
61// a few useful functions used by stringmap
62void splitmapentry (const text_t &mapentry, text_t &from, text_t &to);
63void joinmapentry (const text_t &from, const text_t &to, text_t &mapentry);
64
65
66#endif
Note: See TracBrowser for help on using the repository browser.