File indexing completed on 2026-05-10 08:42:46
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_CORE_USERSETTINGSCONTROLLER_H
0010 #define LLDB_CORE_USERSETTINGSCONTROLLER_H
0011
0012 #include "lldb/Interpreter/OptionValueProperties.h"
0013 #include "lldb/Utility/Status.h"
0014 #include "lldb/lldb-forward.h"
0015 #include "lldb/lldb-private-enumerations.h"
0016
0017 #include "llvm/ADT/StringRef.h"
0018
0019 #include <vector>
0020
0021 #include <cstddef>
0022 #include <cstdint>
0023
0024 namespace lldb_private {
0025 class CommandInterpreter;
0026 class ExecutionContext;
0027 class Property;
0028 class Stream;
0029 }
0030
0031 namespace lldb_private {
0032
0033 class Properties {
0034 public:
0035 Properties();
0036
0037 Properties(const lldb::OptionValuePropertiesSP &collection_sp);
0038
0039 virtual ~Properties();
0040
0041 virtual lldb::OptionValuePropertiesSP GetValueProperties() const {
0042
0043
0044 return m_collection_sp;
0045 }
0046
0047 virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx,
0048 llvm::StringRef property_path,
0049 Status &error) const;
0050
0051 virtual Status SetPropertyValue(const ExecutionContext *exe_ctx,
0052 VarSetOperationType op,
0053 llvm::StringRef property_path,
0054 llvm::StringRef value);
0055
0056 virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx,
0057 Stream &strm, llvm::StringRef property_path,
0058 uint32_t dump_mask, bool is_json = false);
0059
0060 virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx,
0061 Stream &strm, uint32_t dump_mask,
0062 bool is_json = false);
0063
0064 virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
0065 Stream &strm) const;
0066
0067 size_t Apropos(llvm::StringRef keyword,
0068 std::vector<const Property *> &matching_properties) const;
0069
0070
0071
0072
0073
0074
0075
0076
0077 static llvm::StringRef GetExperimentalSettingsName();
0078
0079 static bool IsSettingExperimental(llvm::StringRef setting);
0080
0081 template <typename T>
0082 T GetPropertyAtIndexAs(uint32_t idx, T default_value,
0083 const ExecutionContext *exe_ctx = nullptr) const {
0084 return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx)
0085 .value_or(default_value);
0086 }
0087
0088 template <typename T, typename U = typename std::remove_pointer<T>::type,
0089 std::enable_if_t<std::is_pointer_v<T>, bool> = true>
0090 const U *
0091 GetPropertyAtIndexAs(uint32_t idx,
0092 const ExecutionContext *exe_ctx = nullptr) const {
0093 return m_collection_sp->GetPropertyAtIndexAs<T>(idx, exe_ctx);
0094 }
0095
0096 template <typename T>
0097 bool SetPropertyAtIndex(uint32_t idx, T t,
0098 const ExecutionContext *exe_ctx = nullptr) const {
0099 return m_collection_sp->SetPropertyAtIndex<T>(idx, t, exe_ctx);
0100 }
0101
0102 protected:
0103 lldb::OptionValuePropertiesSP m_collection_sp;
0104 };
0105
0106 }
0107
0108 #endif