options.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
  24. /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
  25. /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
  26. /*%% (c) Copyright 1993, 1994 Novell, Inc. */
  27. /*%% $XConsortium: options.h /main/3 1995/10/20 16:25:40 rswiston $ */
  28. /* -*-C++-*-
  29. *
  30. * options.h
  31. *
  32. * Class definitions for classes to parse and hold options from
  33. * the command lines.
  34. *
  35. * Part of the ToolTalk/Link Service data base inspect and repair tool.
  36. *
  37. * Copyright (c) 1990 by Sun Microsystems, Inc.
  38. */
  39. #ifndef _OPTIONS_H
  40. #define _OPTIONS_H
  41. #include "util/tt_string.h"
  42. #include "binkey.h"
  43. // Options common to both ttdbck and lsdbck
  44. class Dbck_options : public _Tt_object {
  45. public:
  46. Dbck_options();
  47. int set_opts(int argc, char **argv);
  48. const _Tt_string_list_ptr &dbdirectories() const {
  49. return _dbdirectories;};
  50. // Selection options
  51. virtual int selecting_p() const{
  52. return _sel_filename_p | _sel_objid_p | _sel_type_p;
  53. }
  54. int sel_filename_p()const{return _sel_filename_p;};
  55. const _Tt_string &sel_filename() const{return _sel_filename;};
  56. int sel_objid_p() const{return _sel_objid_p;};
  57. _Tt_db_key_ptr sel_objid_key() const{return _sel_objid_key;};
  58. int sel_type_p() const{return _sel_type_p;};
  59. const _Tt_string &sel_type() const{return _sel_type;};
  60. // Diagnosis options
  61. virtual int diagnosing_p() const{
  62. return _diag_badform_p | _diag_exist_p;
  63. };
  64. int diag_badform_p()const{return _diag_badform_p;};
  65. int diag_exist_p() {return _diag_exist_p;};
  66. // Display options
  67. virtual int displaying_p() const{
  68. return _disp_id_p | _disp_mand_p | _disp_prop_p;
  69. };
  70. int disp_id_p() const{return _disp_id_p;};
  71. int disp_mand_p() const{return _disp_mand_p;};
  72. int disp_prop_p() const{return _disp_prop_p;};
  73. // Repair options
  74. // Note repair_netisam_p is not included in repairing_p since
  75. // netisam repair occurs *before* inspection, instead of after.
  76. virtual int repairing_p() const{
  77. return _repair_type_p | _repair_delete_p;
  78. };
  79. int repair_netisam_p() const{return _repair_netisam_p;};
  80. int repair_type_p() const{return _repair_type_p;};
  81. const _Tt_string &repair_type() const{return _repair_type;};
  82. int repair_delete_p() const{return _repair_delete_p;};
  83. int debug_level() const{return _debug_level;};
  84. virtual char * type_string() const {
  85. return "Dbck_options";
  86. };
  87. virtual void print(FILE *f = stdout) const;
  88. protected:
  89. _Tt_string_list_ptr _dbdirectories;
  90. // Selection options
  91. int _sel_filename_p;
  92. _Tt_string _sel_filename; // shell wildcard pattern
  93. int _sel_objid_p;
  94. _Tt_db_key_ptr _sel_objid_key;
  95. int _sel_type_p;
  96. _Tt_string _sel_type; // shell wildcard pattern
  97. // Diagnosis options
  98. int _diag_badform_p;
  99. int _diag_exist_p;
  100. // Display options
  101. int _disp_id_p;
  102. int _disp_mand_p;
  103. int _disp_prop_p;
  104. // Repair options
  105. int _repair_netisam_p;
  106. int _repair_type_p;
  107. _Tt_string _repair_type;
  108. int _repair_delete_p;
  109. int _debug_level;
  110. virtual char * optstring()=0;
  111. virtual int set_option(int optchar, const char *optval)=0;
  112. int set_common_option(int optchar,
  113. const char *optval);
  114. };
  115. #endif