Add GNU LGPL headers to all .c .C and .h files
[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
59 /*************************************/
60 // The info_lib class
61 /*************************************/
62
63 class info_lib : public primitive
64 {
65
66 public:
67    info_lib(char** set_name_array, char** list_name_array,
68             char* info_lib_dir = 0, char* selected_base_name = 0, 
69             char* info_lib_name = "", int descriptor = -1); 
70
71    virtual ~info_lib();
72
73 // define a base 
74    Boolean define_info_base( char* base_name, 
75                              char* base_desc,
76                              char* spec_file_path
77                            );
78
79
80 // get a base (the manager of a collection of documents)
81    info_base* get_info_base(const char* info_base_name);
82
83 // get number of info bases in the lib
84    int num_of_bases() { return info_base_list.count(); };
85
86 // info_lib path/name 
87    const char* get_info_lib_path() { return info_lib_path; };
88    const char* get_info_lib_name() { return info_lib_name; };
89    const char* get_info_lib_uid() { return info_lib_uid; };
90
91 // iterator. 0 is the termination value
92 // can be used to get all base names
93    long first() { return info_base_list.first(); };  
94    info_base* operator()(long ind) {
95      return (info_base*)(((dlist_void_ptr_cell*)ind)->void_ptr());
96    };
97    void next(long& ind) { info_base_list.next(ind); };
98
99
100    enum TestSelector { LOC, GRA };
101    info_base* getInfobaseByComponent( const char *locator_string, 
102                            enum TestSelector sel);
103    info_base** getInfobasesByComponent( char **locator_strings, 
104                              int count, enum TestSelector sel);
105
106    int bad_infobases();
107    const char* get_bad_infobase_path(int);
108    const char* get_bad_infobase_name(int);
109
110    int descriptor() { return f_descriptor; };
111
112 protected:
113    char info_lib_path[PATHSIZ];
114    char info_lib_name[PATHSIZ];
115    char info_lib_uid[UIDSIZ];
116    dlist info_base_list;
117
118    char** set_nm_list;
119    char** list_nm_list;
120
121    object_dict *f_obj_dict;
122
123    info_base* _init_info_base( const char* new_db_path, 
124                               const char* base_name,
125                               const char* base_desc,
126                               const char* base_uid,
127                               const char* base_locale,
128                               const mm_version& v
129                              );
130
131
132    int   f_bad_base_array_size;
133    int   f_bad_info_bases;
134    char** f_bad_info_base_paths;
135    char** f_bad_info_base_names;
136
137    int f_descriptor;
138
139 /*
140    void define_composites(composite_mgr_t* mgr_ptr,
141                           char* new_db_path,
142                           char** def_strings,
143                           Boolean& base_exist);
144 */
145 };
146
147 typedef info_lib* info_libPtr;
148
149
150 #endif