libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
RcFile.h
1// SPDX-FileCopyrightText: 2003-2004, 2018, 2020, 2025-2026 Carlo Wood
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#ifndef LIBCWD_CLASS_RCFILE_H
7#define LIBCWD_CLASS_RCFILE_H
8
9#include <iosfwd>
10#include <string>
11#include <vector>
12
13namespace libcwd {
14
15class Channel;
16
27class RcFile
28{
29 private:
30 std::string konsole_command_; // How to execute a command in a window.
31 std::string gdb_bin_; // Path to 'gdb'.
32
33 char const* rcname_; // Name of rcfile.
34 bool env_set_; // Whether or not LIBCWD_RCFILE_NAME is set.
35 bool read_called_;
36
37#if CWDEBUG_LOCATION
38 bool elfutils_on_;
39#endif
40
41 public:
45 RcFile() : env_set_(false), read_called_(false) { }
46 virtual ~RcFile() { }
47
48 private:
49 void print_delayed_msg(int env_var, std::string const& value) const;
50 void set_all_channels_on();
51 void set_all_channels_off(bool warning_on);
52
53 static bool S_exists(char const* name);
54 std::string determine_rcfile_name();
55
56 enum action_nt
57 {
58 toggle,
59 on,
60 off
61 };
62 void process_channel(Channel& debugChannel, std::string const& mask, action_nt const action);
63 void process_channels(std::string list, action_nt const action);
64
65 public:
69 void read();
73 std::string const& konsole_command() const { return konsole_command_; }
77 std::string const& gdb_bin() const { return gdb_bin_; }
81 bool read_called() const { return read_called_; }
82
83 protected:
93 virtual bool unknown_keyword(std::string const& keyword, std::string const& value);
94};
95
96extern RcFile rcfile;
97
103inline void read_rcfile()
104{
105 rcfile.read();
106}
107
108} // namespace libcwd
109
110#endif // LIBCWD_CLASS_RCFILE_H
This object represents a debug channel, it has a fixed label. A debug channel can be viewed upon as a...
Definition Channel.h:74
This object represents a runtime configuration file.
Definition RcFile.h:28
virtual bool unknown_keyword(std::string const &keyword, std::string const &value)
Virtual function called for unknown keywords.
bool read_called() const
Returns true when this object is initialized.
Definition RcFile.h:81
std::string const & gdb_bin() const
Returns the command line string as set with the 'gdb_bin' keyword.
Definition RcFile.h:77
void read()
Initialize this object by reading the rcfile.
std::string const & konsole_command() const
Returns the command line string as set with the 'xterm' keyword.
Definition RcFile.h:73
RcFile()
Construct a rcfile object.
Definition RcFile.h:45
namespace for libcwd.
void read_rcfile()
Calls libcwd::rcfile.read().
Definition RcFile.h:103