71c4df1b0ca931c235b808cb2f27846a0f4f1698
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / UAS / DtSR / DtSR_SearchZones.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 // $XConsortium: DtSR_SearchZones.C /main/6 1996/09/14 09:18:57 barstow $
24
25 #include <string.h>
26
27 #if defined(_AIX)
28 #include <strings.h>            // strcasecmp()
29 #endif
30
31 #if defined(USL)
32 extern "C" {
33    extern char *strcasecmp (const char*, const char *);
34 }
35 #endif
36
37 #include "DtSR_SearchZones.hh"
38
39 DtSR_SearchZones::uas_zones
40 DtSR_SearchZones::keytype2zone(const char key)
41 {
42     switch (key) {
43         case 'D' :
44             return uas_bodies;
45         case 'H' :
46             return uas_titles;
47         case 'G' :
48             return uas_graphics;
49         case 'E' :
50             return uas_examples;
51         case 'I' :
52             return uas_indexes;
53         case 'T' :
54             return uas_tables;
55         case 'A' :
56             return uas_all;
57         default  :
58             break;
59     }
60     return uas_inv;
61 }
62
63 DtSR_SearchZones::uas_zones
64 DtSR_SearchZones::zonename2zone(const char* name)
65 {
66     if (! strcasecmp(name, "TITLE"))
67         return UAS_SearchZones::uas_titles;
68     if (! strcasecmp(name, "EXAMPLE"))
69         return UAS_SearchZones::uas_examples;
70     if (! strcasecmp(name, "INDEX"))
71         return UAS_SearchZones::uas_indexes;
72     if (! strcasecmp(name, "TABLE"))
73         return UAS_SearchZones::uas_tables;
74     if (! strcasecmp(name, "GRAPHIC"))
75         return UAS_SearchZones::uas_graphics;
76
77     return UAS_SearchZones::uas_inv;
78 }