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 #if CWDEBUG_LOCATION
00059 bool M_bfd_on;
00060 #endif
00061
00062 public:
00066 rcfile_ct() : M_env_set(false), M_read_called(false) { }
00067 virtual ~rcfile_ct() { }
00068
00069 private:
00070 void M_print_delayed_msg(void) const;
00071
00072 static bool S_exists(char const* name);
00073 std::string M_determine_rcfile_name(void);
00074
00075 enum action_nt { toggle, on, off };
00076 void M_process_channel(channel_ct& debugChannel, std::string const& mask, action_nt const action);
00077 void M_process_channels(std::string list, action_nt const action);
00078
00079 public:
00083 void read(void);
00087 std::string const& konsole_command(void) const { return M_konsole_command; }
00091 std::string const& gdb_bin(void) const { return M_gdb_bin; }
00095 bool read_called(void) const { return M_read_called; }
00096
00097 protected:
00107 virtual bool unknown_keyword(std::string const& keyword, std::string const& value);
00108 };
00109
00110 extern rcfile_ct rcfile;
00111
00117 inline void read_rcfile(void)
00118 {
00119 rcfile.read();
00120 }
00121
00122 }
00123
00124 #endif // LIBCWD_CLASS_RCFILE_H