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

Last change on this file since 878 was 534, checked in by sjboddie, 25 years ago

added gpl notice

  • 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 * $Id: maptools.h 534 1999-09-07 04:57:43Z sjboddie $
25 *
26 *********************************************************************/
27
28
29#ifndef MAPTOOLS_H
30#define MAPTOOLS_H
31
32
33#include "gsdlconf.h"
34#include "text_t.h"
35
36// stringmap is a mapping which remembers the original order
37// of the map, but is very fast to look up.
38class stringmap {
39protected:
40 text_tarray fromorder;
41 text_tmap mapfrom;
42
43public:
44 void clear ();
45
46 void importmap (const text_tarray &maparray);
47 void exportmap (text_tarray &maparray) const;
48
49 void getfromarray (text_tarray &fromarray) const;
50 void gettoarray (text_tarray &toarray) const;
51
52 bool fromexists (const text_t &from) const;
53 bool toexists (const text_t &to) const;
54
55 // from2to and to2from return false if the key (the "from"
56 // field or the "to" field) cannot be found
57 bool from2to (const text_t &from, text_t &to) const;
58 bool to2from (const text_t &to, text_t &from) const;
59};
60
61
62// a few useful functions used by stringmap
63void splitmapentry (const text_t &mapentry, text_t &from, text_t &to);
64void joinmapentry (const text_t &from, const text_t &to, text_t &mapentry);
65
66
67#endif
Note: See TracBrowser for help on using the repository browser.