OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / oliasdb / mmdb.h
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 librararies 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: mmdb.h /main/5 1996/10/26 18:19:50 cde-hal $ */
24
25 #ifndef _x_mmdb_h
26 #define _x_mmdb_h
27
28 #include "api/info_lib.h"
29 #include "mgrs/managers.h"
30 #include "dstr/void_ptr_array.h"
31
32 #include "oliasdb/olias_consts.h"
33 #include "oliasdb/node_hd.h"
34 #include "oliasdb/graphic_hd.h"
35 #include "oliasdb/toc_hd.h"
36 #include "oliasdb/locator_hd.h"
37 #include "oliasdb/doc_hd.h"
38 #include "oliasdb/stylesheet_hd.h"
39 #include "oliasdb/dlp_hd.h"
40 #include "oliasdb/mark.h"
41
42
43 class OLIAS_DB {
44
45 protected:
46    char** info_base_set_names;
47    char** info_base_list_names;
48
49    managers internal_managers; // this should be constructed before 
50                                // the following objects!!!
51
52    dlp                  dlp_template;
53    doc                  doc_template;
54    graphic              graphic_template;
55    olias_locator        locator_template;
56    olias_node           node_template;
57    toc                  toc_template;
58    umark                mark_template;
59    stylesheet           stylesheet_template;
60
61    void_ptr_array infolib_array;
62
63 protected:
64    Boolean 
65    real_destroy_info_base(const char* infoLibPath, const char* base_name);
66
67    Boolean real_destroy(const char* infoLibPath, const char* infoLibName);
68    info_lib* getInfoLib(const char* infoLibUid, int& i);
69
70 public:
71    OLIAS_DB();
72    virtual ~OLIAS_DB();
73
74    info_lib* openInfoLib(const char* path = getenv("MMDB_PATH"), 
75                          const char* selectedBookCaseName = 0,
76                          const char* infoLibName = "InfoLibrary"
77                         );
78    // NOTE: default argument ("InfoLibrary") needs to be abandoned.
79    void closeInfoLib(const char* infoLibUid = "InfoLibrary");
80    info_lib* getInfoLib(int descriptor);
81
82 // complete remove file dir structure for the infolib
83 // The action will be taken when the infolib is in closed state
84    Boolean destroy(const char* infoLibPath, const char* infoLibName = "InfoLibrary");
85
86 // return 1 if path is a valid dir path and the directory contains
87 // names.mmdb or bookcase.map file.
88    int validInfoLibPath(const char* path);
89
90    int major_code_version();
91    int minor_code_version();
92    mm_version code_version();
93
94    int numItems() { return infolib_array.no_elmts(); }
95    char* getInfoLibUid(char*);
96
97 };
98
99 #endif
100