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

class_rcfile.h

00001 // $Header: /cvsroot/libcwd/libcwd/include/libcwd/class_rcfile.h,v 1.6 2004/08/19 17:28:34 libcw Exp $
00002 //
00003 // Copyright (C) 2003 - 2004, by
00004 // 
00005 // Carlo Wood, Run on IRC <carlo@alinoe.com>
00006 // RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
00007 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
00008 //
00009 // This file may be distributed under the terms of the Q Public License
00010 // version 1.0 as appearing in the file LICENSE.QPL included in the
00011 // packaging of this file.
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;                        // How to execute a command in a window.
00051   std::string M_gdb_bin;                                // Path to 'gdb'.
00052 
00053   char const* M_rcname;                                 // Name of rcfile.
00054   bool M_env_set;                                       // Whether or not LIBCWD_RCFILE_NAME is set.
00055   bool M_read_called;
00056 
00057   bool M_malloc_on;                                     // Used on rcfile_ct::read.
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 } // namespace libcwd
00123 
00124 #endif // LIBCWD_CLASS_RCFILE_H
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.