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

/usr/src/libcwd/libcwd/include/libcwd/class_rcfile.h

00001 // $Header: /cvsroot/libcwd/libcwd/include/libcwd/class_rcfile.h,v 1.5 2004/06/03 12:23:07 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   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 } // namespace libcwd
00121 
00122 #endif // LIBCWD_CLASS_RCFILE_H
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.