Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / UAS / DtSR / DtSR_SearchEngine.hh
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_SearchEngine.hh /main/5 1996/05/29 12:31:30 rcs $
24 /*      Copyright (c) 1995,1996 FUJITSU LIMITED         */
25 /*      All Rights Reserved                             */
26
27 #ifndef _DTSR_SEARCHENGINE_HH_
28 #define _DTSR_SEARCHENGINE_HH_
29
30 #include "UAS_Pointer.hh"
31 #include "UAS_SearchEngine.hh"
32
33 extern "C" {
34 #include "Search.h"
35 }
36
37 #include "DtSR_Parser.hh"
38 #include "DtSR_SearchResults.hh"
39 #include "DtSR_SearchResultsEntry.hh"
40
41 class DtSR_SearchEngine : public UAS_SearchEngine
42 {
43   public:
44     static DtSR_SearchEngine &search_engine
45                                 (UAS_PtrList<const char> *bcases = NULL);
46
47     UAS_Pointer<UAS_SearchResults> search (UAS_String query,
48                                            UAS_SearchScope & scope,
49                                            unsigned int maxdocs);
50
51     ~DtSR_SearchEngine();
52
53     UAS_Pointer<UAS_String> db_name(int n);
54     char *char_db_name(int n);
55     int db_count() { return f_dbcount; }
56
57   protected:
58     DtSR_SearchEngine();
59     void init(UAS_PtrList<const char> *bcases);
60
61     // NOTE: compress_DtSrResult frees res space
62     UAS_Pointer<UAS_List<UAS_SearchResultsEntry> >
63                 compress_DtSrResult(DtSrResult*&, long &);
64
65   private:
66                                  // enforce as a singleton class
67     static DtSR_SearchEngine  *f_search_engine;
68
69     UAS_String f_config_path;
70
71     char        **f_dbnames;
72     int         f_dbcount;
73
74     unsigned int f_valid_bc_map;
75
76     static int f_init_count;
77 };
78
79 // The DtSR_SE is responsible for translating the query from OQL
80 // into the query structure required by the DtSearch engine and does the
81 // actual search. It then calls the DtSearchResult constructor with the
82 // cookies required to retrieve results.
83
84 #endif