info_lib.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. /*
  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. #ifndef _info_lib_h
  50. #define _info_lib_h 1
  51. #include "dstr/dlist.h"
  52. #include "dstr/dlist_void_ptr_cell.h"
  53. #include "api/info_base.h"
  54. #include "utility/funcs.h"
  55. #include "schema/object_dict.h"
  56. /*************************************/
  57. // The info_lib class
  58. /*************************************/
  59. class info_lib : public primitive
  60. {
  61. public:
  62. info_lib(char** set_name_array, char** list_name_array,
  63. char* info_lib_dir = 0, char* selected_base_name = 0,
  64. char* info_lib_name = (char*)"", int descriptor = -1);
  65. virtual ~info_lib();
  66. // define a base
  67. Boolean define_info_base( char* base_name,
  68. char* base_desc,
  69. char* spec_file_path
  70. );
  71. // get a base (the manager of a collection of documents)
  72. info_base* get_info_base(const char* info_base_name);
  73. // get number of info bases in the lib
  74. int num_of_bases() { return info_base_list.count(); };
  75. // info_lib path/name
  76. const char* get_info_lib_path() { return info_lib_path; };
  77. const char* get_info_lib_name() { return info_lib_name; };
  78. const char* get_info_lib_uid() { return info_lib_uid; };
  79. // iterator. 0 is the termination value
  80. // can be used to get all base names
  81. long first() { return info_base_list.first(); };
  82. info_base* operator()(long ind) {
  83. return (info_base*)(((dlist_void_ptr_cell*)ind)->void_ptr());
  84. };
  85. void next(long& ind) { info_base_list.next(ind); };
  86. enum TestSelector { LOC, GRA };
  87. info_base* getInfobaseByComponent( const char *locator_string,
  88. enum TestSelector sel);
  89. info_base** getInfobasesByComponent( char **locator_strings,
  90. int count, enum TestSelector sel);
  91. int bad_infobases();
  92. const char* get_bad_infobase_path(int);
  93. const char* get_bad_infobase_name(int);
  94. int descriptor() { return f_descriptor; };
  95. protected:
  96. char info_lib_path[PATHSIZ];
  97. char info_lib_name[PATHSIZ];
  98. char info_lib_uid[UIDSIZ];
  99. dlist info_base_list;
  100. char** set_nm_list;
  101. char** list_nm_list;
  102. object_dict *f_obj_dict;
  103. info_base* _init_info_base( const char* new_db_path,
  104. const char* base_name,
  105. const char* base_desc,
  106. const char* base_uid,
  107. const char* base_locale,
  108. const mm_version& v
  109. );
  110. int f_bad_base_array_size;
  111. int f_bad_info_bases;
  112. char** f_bad_info_base_names;
  113. char** f_bad_info_base_paths;
  114. int f_descriptor;
  115. /*
  116. void define_composites(composite_mgr_t* mgr_ptr,
  117. char* new_db_path,
  118. char** def_strings,
  119. Boolean& base_exist);
  120. */
  121. };
  122. typedef info_lib* info_libPtr;
  123. #endif