source: trunk/gsdl/src/colservr/maptools.h@ 1285

Last change on this file since 1285 was 1285, checked in by sjboddie, 24 years ago

Removed CVS logging information from source files

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 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 exportmap (text_tarray &maparray) const;
46
47 void getfromarray (text_tarray &fromarray) const;
48 void gettoarray (text_tarray &toarray) const;
49
50 bool fromexists (const text_t &from) const;
51 bool toexists (const text_t &to) const;
52
53 // from2to and to2from return false if the key (the "from"
54 // field or the "to" field) cannot be found
55 bool from2to (const text_t &from, text_t &to) const;
56 bool to2from (const text_t &to, text_t &from) const;
57};
58
59
60// a few useful functions used by stringmap
61void splitmapentry (const text_t &mapentry, text_t &from, text_t &to);
62void joinmapentry (const text_t &from, const text_t &to, text_t &mapentry);
63
64
65#endif
Note: See TracBrowser for help on using the repository browser.