OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / api / info_lib.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 /*
24  * $XConsortium: info_lib.h /main/5 1996/09/04 01:37:43 cde-hal $
25  *
26  * Copyright (c) 1992 HAL Computer Systems International, Ltd.
27  * All rights reserved.  Unpublished -- rights reserved under
28  * the Copyright Laws of the United States.  USE OF A COPYRIGHT
29  * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
30  * OR DISCLOSURE.
31  * 
32  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
33  * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
34  * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
35  * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
36  * INTERNATIONAL, LTD.
37  * 
38  *                         RESTRICTED RIGHTS LEGEND
39  * Use, duplication, or disclosure by the Government is subject
40  * to the restrictions as set forth in subparagraph (c)(l)(ii)
41  * of the Rights in Technical Data and Computer Software clause
42  * at DFARS 252.227-7013.
43  *
44  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
45  *                  1315 Dell Avenue
46  *                  Campbell, CA  95008
47  * 
48  */
49
50
51 #ifndef _info_lib_h
52 #define _info_lib_h 1
53
54 #include "dstr/dlist.h"
55 #include "dstr/dlist_void_ptr_cell.h"
56 #include "api/info_base.h"
57 #include "utility/funcs.h"
58 #include "schema/object_dict.h"
59
60 /*************************************/
61 // The info_lib class
62 /*************************************/
63
64 class info_lib : public primitive
65 {
66
67 public:
68    info_lib(char** set_name_array, char** list_name_array,
69             char* info_lib_dir = 0, char* selected_base_name = 0, 
70             char* info_lib_name = (char*)"", int descriptor = -1);
71
72    virtual ~info_lib();
73
74 // define a base 
75    Boolean define_info_base( char* base_name, 
76                              char* base_desc,
77                              char* spec_file_path
78                            );
79
80
81 // get a base (the manager of a collection of documents)
82    info_base* get_info_base(const char* info_base_name);
83
84 // get number of info bases in the lib
85    int num_of_bases() { return info_base_list.count(); };
86
87 // info_lib path/name 
88    const char* get_info_lib_path() { return info_lib_path; };
89    const char* get_info_lib_name() { return info_lib_name; };
90    const char* get_info_lib_uid() { return info_lib_uid; };
91
92 // iterator. 0 is the termination value
93 // can be used to get all base names
94    long first() { return info_base_list.first(); };  
95    info_base* operator()(long ind) {
96      return (info_base*)(((dlist_void_ptr_cell*)ind)->void_ptr());
97    };
98    void next(long& ind) { info_base_list.next(ind); };
99
100
101    enum TestSelector { LOC, GRA };
102    info_base* getInfobaseByComponent( const char *locator_string, 
103                            enum TestSelector sel);
104    info_base** getInfobasesByComponent( char **locator_strings, 
105                              int count, enum TestSelector sel);
106
107    int bad_infobases();
108    const char* get_bad_infobase_path(int);
109    const char* get_bad_infobase_name(int);
110
111    int descriptor() { return f_descriptor; };
112
113 protected:
114    char info_lib_path[PATHSIZ];
115    char info_lib_name[PATHSIZ];
116    char info_lib_uid[UIDSIZ];
117    dlist info_base_list;
118
119    char** set_nm_list;
120    char** list_nm_list;
121
122    object_dict *f_obj_dict;
123
124    info_base* _init_info_base( const char* new_db_path, 
125                               const char* base_name,
126                               const char* base_desc,
127                               const char* base_uid,
128                               const char* base_locale,
129                               const mm_version& v
130                              );
131
132
133    int   f_bad_base_array_size;
134    int   f_bad_info_bases;
135    char** f_bad_info_base_names;
136    char** f_bad_info_base_paths;
137
138    int f_descriptor;
139
140 /*
141    void define_composites(composite_mgr_t* mgr_ptr,
142                           char* new_db_path,
143                           char** def_strings,
144                           Boolean& base_exist);
145 */
146 };
147
148 typedef info_lib* info_libPtr;
149
150
151 #endif