OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / Basic / InfoBase.hh
1 /*
2  * $XConsortium: InfoBase.hh /main/3 1996/06/11 16:19:27 cde-hal $
3  *
4  * Copyright (c) 1992 HAL Computer Systems International, Ltd.
5  * All rights reserved.  Unpublished -- rights reserved under
6  * the Copyright Laws of the United States.  USE OF A COPYRIGHT
7  * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
8  * OR DISCLOSURE.
9  * 
10  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
11  * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
12  * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
13  * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
14  * INTERNATIONAL, LTD.
15  * 
16  *                         RESTRICTED RIGHTS LEGEND
17  * Use, duplication, or disclosure by the Government is subject
18  * to the restrictions as set forth in subparagraph (c)(l)(ii)
19  * of the Rights in Technical Data and Computer Software clause
20  * at DFARS 252.227-7013.
21  *
22  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
23  *                  1315 Dell Avenue
24  *                  Campbell, CA  95008
25  * 
26  */
27
28 class InfobaseEntry ;
29
30 class InfoBase : public LibraryElement
31 {
32   enum { AVERAGE_BOOKS_PER = 6 };
33
34 public: // functions
35   DEF_CLASS (InfoBase);
36
37   InfoBase (info_base *infobase)
38     : f_infobase (infobase),
39       f_search_info(NULL)
40     { display_flag (0); }
41
42   // NOTE: hide LEND here ! 
43
44   const char *desc() const      { return f_infobase->get_base_desc() ; }
45   const char *path() const      { return f_infobase->get_base_path() ; }
46   const char *name() const      { return f_infobase->get_base_name() ; }
47
48
49   // NOTE: need to get rid of const casts (needs lend support?) 
50   const char *display_as()
51     { return ((const char *) f_infobase->get_base_desc()); }
52
53   const char *id()
54     { return ((const char *) f_infobase->get_base_name()); }
55
56   InfobaseEntry *search_info() const 
57   { return f_search_info ; }
58   
59   InfobaseEntry *search_info(InfobaseEntry* info);
60
61   bool has_children_internal();
62
63 protected: // functions
64   void create_children();
65   void display();
66
67 protected: // variables
68   info_base     *f_infobase;
69   InfobaseEntry *f_search_info ; // storage freed elsewhere (SearchEngine)
70 };
71
72 inline InfobaseEntry *
73 InfoBase::search_info(InfobaseEntry * info)
74
75     assert(f_search_info == NULL); // debugging only, no error handline reqd - jbm 
76     f_search_info = info ; 
77     return info; 
78 }
79