Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

class_rcfile.h
1 // $Header$
2 //
3 // Copyright (C) 2003 - 2004, by
4 //
5 // Carlo Wood, Run on IRC <carlo@alinoe.com>
6 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
7 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
8 //
9 // This file may be distributed under the terms of the Q Public License
10 // version 1.0 as appearing in the file LICENSE.QPL included in the
11 // packaging of this file.
12 //
13 
14 #ifndef LIBCWD_SYS_H
15 #error "You need to #include "sys.h" at the top of every source file (which in turn should #include "sys.h")."
16 #endif
17 
18 #ifndef LIBCWD_CLASS_RCFILE_H
19 #define LIBCWD_CLASS_RCFILE_H
20 
21 #ifndef LIBCW_IOSFWD
22 #define LIBCW_IOSFWD
23 #include <iosfwd>
24 #endif
25 #ifndef LIBCW_VECTOR
26 #define LIBCW_VECTOR
27 #include <vector>
28 #endif
29 #ifndef LIBCW_STRING
30 #define LIBCW_STRING
31 #include <string>
32 #endif
33 
34 namespace libcwd {
35 
36 class channel_ct;
37 
48 class rcfile_ct {
49 private:
50  std::string M_konsole_command; // How to execute a command in a window.
51  std::string M_gdb_bin; // Path to 'gdb'.
52 
53  char const* M_rcname; // Name of rcfile.
54  bool M_env_set; // Whether or not LIBCWD_RCFILE_NAME is set.
55  bool M_read_called;
56 
57  bool M_malloc_on; // Used on rcfile_ct::read.
58 #if CWDEBUG_LOCATION
59  bool M_bfd_on;
60 #endif
61 
62 public:
66  rcfile_ct() : M_env_set(false), M_read_called(false) { }
67  virtual ~rcfile_ct() { }
68 
69 private:
70  void M_print_delayed_msg() const;
71 
72  static bool S_exists(char const* name);
73  std::string M_determine_rcfile_name();
74 
75  enum action_nt { toggle, on, off };
76  void M_process_channel(channel_ct& debugChannel, std::string const& mask, action_nt const action);
77  void M_process_channels(std::string list, action_nt const action);
78 
79 public:
83  void read();
87  std::string const& konsole_command() const { return M_konsole_command; }
91  std::string const& gdb_bin() const { return M_gdb_bin; }
95  bool read_called() const { return M_read_called; }
96 
97 protected:
107  virtual bool unknown_keyword(std::string const& keyword, std::string const& value);
108 };
109 
110 extern rcfile_ct rcfile;
111 
117 inline void read_rcfile()
118 {
119  rcfile.read();
120 }
121 
122 } // namespace libcwd
123 
124 #endif // LIBCWD_CLASS_RCFILE_H
This object represents a runtime configuration file.
Definition: class_rcfile.h:48
rcfile_ct()
Construct a rcfile object.
Definition: class_rcfile.h:66
std::string const & gdb_bin() const
Returns the command line string as set with the 'gdb_bin' keyword.
Definition: class_rcfile.h:91
std::string const & konsole_command() const
Returns the command line string as set with the 'xterm' keyword.
Definition: class_rcfile.h:87
void read()
Initialize this object by reading the rcfile.
bool read_called() const
Returns true when this object is initialized.
Definition: class_rcfile.h:95
virtual bool unknown_keyword(std::string const &keyword, std::string const &value)
Virtual function called for unknown keywords.
namespace for libcwd.
Definition: debug.cc:87
void read_rcfile()
Calls libcwd::rcfile.read().
Definition: class_rcfile.h:117
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.