1 //====-- UserSettingsController.h --------------------------------*- C++-*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_UserSettingsController_h_
10 #define liblldb_UserSettingsController_h_
12 #include "lldb/Utility/Status.h"
13 #include "lldb/lldb-forward.h"
14 #include "lldb/lldb-private-enumerations.h"
16 #include "llvm/ADT/StringRef.h"
23 namespace lldb_private {
24 class CommandInterpreter;
26 class ExecutionContext;
31 namespace lldb_private {
35 Properties() : m_collection_sp() {}
37 Properties(const lldb::OptionValuePropertiesSP &collection_sp)
38 : m_collection_sp(collection_sp) {}
40 virtual ~Properties() {}
42 virtual lldb::OptionValuePropertiesSP GetValueProperties() const {
43 // This function is virtual in case subclasses want to lazily implement
44 // creating the properties.
45 return m_collection_sp;
48 virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx,
49 llvm::StringRef property_path,
53 virtual Status SetPropertyValue(const ExecutionContext *exe_ctx,
54 VarSetOperationType op,
55 llvm::StringRef property_path,
56 llvm::StringRef value);
58 virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx,
59 Stream &strm, llvm::StringRef property_path,
62 virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx,
63 Stream &strm, uint32_t dump_mask);
65 virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
68 size_t Apropos(llvm::StringRef keyword,
69 std::vector<const Property *> &matching_properties) const;
71 lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
74 // We sometimes need to introduce a setting to enable experimental features,
75 // but then we don't want the setting for these to cause errors when the
76 // setting goes away. Add a sub-topic of the settings using this
77 // experimental name, and two things will happen. One is that settings that
78 // don't find the name will not be treated as errors. Also, if you decide to
79 // keep the settings just move them into the containing properties, and we
80 // will auto-forward the experimental settings to the real one.
81 static const char *GetExperimentalSettingsName();
83 static bool IsSettingExperimental(llvm::StringRef setting);
86 lldb::OptionValuePropertiesSP m_collection_sp;
89 } // namespace lldb_private
91 #endif // liblldb_UserSettingsController_h_