LLDB  mainline
UserSettingsController.h
Go to the documentation of this file.
1 //====-- UserSettingsController.h --------------------------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_UserSettingsController_h_
10 #define liblldb_UserSettingsController_h_
11 
12 #include "lldb/Utility/Status.h"
13 #include "lldb/lldb-forward.h"
15 
16 #include "llvm/ADT/StringRef.h"
17 
18 #include <vector>
19 
20 #include <stddef.h>
21 #include <stdint.h>
22 
23 namespace lldb_private {
24 class CommandInterpreter;
25 }
26 namespace lldb_private {
27 class ConstString;
28 }
29 namespace lldb_private {
30 class ExecutionContext;
31 }
32 namespace lldb_private {
33 class Property;
34 }
35 namespace lldb_private {
36 class Stream;
37 }
38 
39 namespace lldb_private {
40 
41 class Properties {
42 public:
44 
45  Properties(const lldb::OptionValuePropertiesSP &collection_sp)
46  : m_collection_sp(collection_sp) {}
47 
48  virtual ~Properties() {}
49 
50  virtual lldb::OptionValuePropertiesSP GetValueProperties() const {
51  // This function is virtual in case subclasses want to lazily implement
52  // creating the properties.
53  return m_collection_sp;
54  }
55 
56  virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx,
57  llvm::StringRef property_path,
58  bool will_modify,
59  Status &error) const;
60 
61  virtual Status SetPropertyValue(const ExecutionContext *exe_ctx,
63  llvm::StringRef property_path,
64  llvm::StringRef value);
65 
66  virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx,
67  Stream &strm, llvm::StringRef property_path,
68  uint32_t dump_mask);
69 
70  virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx,
71  Stream &strm, uint32_t dump_mask);
72 
73  virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
74  Stream &strm) const;
75 
76  size_t Apropos(llvm::StringRef keyword,
77  std::vector<const Property *> &matching_properties) const;
78 
79  lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
80  ConstString name);
81 
82  // We sometimes need to introduce a setting to enable experimental features,
83  // but then we don't want the setting for these to cause errors when the
84  // setting goes away. Add a sub-topic of the settings using this
85  // experimental name, and two things will happen. One is that settings that
86  // don't find the name will not be treated as errors. Also, if you decide to
87  // keep the settings just move them into the containing properties, and we
88  // will auto-forward the experimental settings to the real one.
89  static const char *GetExperimentalSettingsName();
90 
91  static bool IsSettingExperimental(llvm::StringRef setting);
92 
93 protected:
94  lldb::OptionValuePropertiesSP m_collection_sp;
95 };
96 
97 } // namespace lldb_private
98 
99 #endif // liblldb_UserSettingsController_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
lldb::OptionValuePropertiesSP m_collection_sp
lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx, ConstString name)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
size_t Apropos(llvm::StringRef keyword, std::vector< const Property *> &matching_properties) const
static bool IsSettingExperimental(llvm::StringRef setting)
virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef property_path, bool will_modify, Status &error) const
static const char * GetExperimentalSettingsName()
VarSetOperationType
Settable state variable types.
virtual Status SetPropertyValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value)
virtual void DumpAllDescriptions(CommandInterpreter &interpreter, Stream &strm) const
virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
Properties(const lldb::OptionValuePropertiesSP &collection_sp)
A uniqued constant string class.
Definition: ConstString.h:38
virtual lldb::OptionValuePropertiesSP GetValueProperties() const
An error handling class.
Definition: Status.h:44
virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm, llvm::StringRef property_path, uint32_t dump_mask)