00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef LIBCWD_SYS_H
00015 #error "You need to #include "sys.h" at the top of every source file (which in turn should #include <libcwd/sys.h>)."
00016 #endif
00017
00018 #ifndef LIBCWD_CLASS_RCFILE_H
00019 #define LIBCWD_CLASS_RCFILE_H
00020
00021 #ifndef LIBCW_IOSFWD
00022 #define LIBCW_IOSFWD
00023 #include <iosfwd>
00024 #endif
00025 #ifndef LIBCW_VECTOR
00026 #define LIBCW_VECTOR
00027 #include <vector>
00028 #endif
00029 #ifndef LIBCW_STRING
00030 #define LIBCW_STRING
00031 #include <string>
00032 #endif
00033
00034 namespace libcwd {
00035
00036 class channel_ct;
00037
00048 class rcfile_ct {
00049 private:
00050 std::string M_konsole_command;
00051 std::string M_gdb_bin;
00052
00053 char const* M_rcname;
00054 bool M_env_set;
00055 bool M_read_called;
00056
00057 bool M_malloc_on;
00058 bool M_bfd_on;
00059
00060 public:
00064 rcfile_ct() : M_env_set(false), M_read_called(false) { }
00065 virtual ~rcfile_ct() { }
00066
00067 private:
00068 void M_print_delayed_msg(void) const;
00069
00070 static bool S_exists(char const* name);
00071 std::string M_determine_rcfile_name(void);
00072
00073 enum action_nt { toggle, on, off };
00074 void M_process_channel(channel_ct& debugChannel, std::string const& mask, action_nt const action);
00075 void M_process_channels(std::string list, action_nt const action);
00076
00077 public:
00081 void read(void);
00085 std::string const& konsole_command(void) const { return M_konsole_command; }
00089 std::string const& gdb_bin(void) const { return M_gdb_bin; }
00093 bool read_called(void) const { return M_read_called; }
00094
00095 protected:
00105 virtual bool unknown_keyword(std::string const& keyword, std::string const& value);
00106 };
00107
00108 extern rcfile_ct rcfile;
00109
00115 inline void read_rcfile(void)
00116 {
00117 rcfile.read();
00118 }
00119
00120 }
00121
00122 #endif // LIBCWD_CLASS_RCFILE_H