aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Core/UserSettingsController.h
blob: 0207187f07181f9db3cc08faca694e14d121db56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//====-- UserSettingsController.h --------------------------------*- C++-*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_UserSettingsController_h_
#define liblldb_UserSettingsController_h_

#include "lldb/Utility/Error.h"             // for Error
#include "lldb/lldb-forward.h"              // for OptionValuePropertiesSP
#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType

#include "llvm/ADT/StringRef.h" // for StringRef

#include <vector>

#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t

namespace lldb_private {
class CommandInterpreter;
}
namespace lldb_private {
class ConstString;
}
namespace lldb_private {
class ExecutionContext;
}
namespace lldb_private {
class Property;
}
namespace lldb_private {
class Stream;
}

namespace lldb_private {

class Properties {
public:
  Properties() : m_collection_sp() {}

  Properties(const lldb::OptionValuePropertiesSP &collection_sp)
      : m_collection_sp(collection_sp) {}

  virtual ~Properties() {}

  virtual lldb::OptionValuePropertiesSP GetValueProperties() const {
    // This function is virtual in case subclasses want to lazily
    // implement creating the properties.
    return m_collection_sp;
  }

  virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx,
                                               llvm::StringRef property_path,
                                               bool will_modify,
                                               Error &error) const;

  virtual Error SetPropertyValue(const ExecutionContext *exe_ctx,
                                 VarSetOperationType op,
    llvm::StringRef property_path, llvm::StringRef value);

  virtual Error DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm,
    llvm::StringRef property_path,
                                  uint32_t dump_mask);

  virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx,
                                     Stream &strm, uint32_t dump_mask);

  virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
                                   Stream &strm) const;

  size_t Apropos(llvm::StringRef keyword,
                 std::vector<const Property *> &matching_properties) const;

  lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
                                               const ConstString &name);

  // We sometimes need to introduce a setting to enable experimental features,
  // but then we don't want the setting for these to cause errors when the
  // setting
  // goes away.  Add a sub-topic of the settings using this experimental name,
  // and
  // two things will happen.  One is that settings that don't find the name will
  // not
  // be treated as errors.  Also, if you decide to keep the settings just move
  // them into
  // the containing properties, and we will auto-forward the experimental
  // settings to the
  // real one.
  static const char *GetExperimentalSettingsName();

  static bool IsSettingExperimental(llvm::StringRef setting);

protected:
  lldb::OptionValuePropertiesSP m_collection_sp;
};

} // namespace lldb_private

#endif // liblldb_UserSettingsController_h_