LLDB mainline
Property.h
Go to the documentation of this file.
1//===-- Property.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 LLDB_INTERPRETER_PROPERTY_H
10#define LLDB_INTERPRETER_PROPERTY_H
11
13#include "lldb/Utility/Flags.h"
14#include "lldb/Utility/Stream.h"
15#include "lldb/lldb-defines.h"
17
18#include <optional>
19#include <string>
20
21namespace lldb_private {
22
23// A structure that can be used to create a global table for all properties.
24// Property class instances can be constructed using one of these.
26 const char *name;
28 bool global; // false == this setting is a global setting by default
30 const char *default_cstr_value;
32 const char *description;
33};
34
36 llvm::ArrayRef<PropertyDefinition> definitions;
37 llvm::StringRef expected_path;
38};
39
40class Property {
41public:
42 Property(const PropertyDefinition &definition);
43
44 Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
45 const lldb::OptionValueSP &value_sp);
46
47 llvm::StringRef GetName() const { return m_name; }
48 llvm::StringRef GetDescription() const { return m_description; }
49
50 const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
51
52 void SetOptionValue(const lldb::OptionValueSP &value_sp) {
53 m_value_sp = value_sp;
54 }
55
56 bool IsValid() const { return (bool)m_value_sp; }
57
58 bool IsGlobal() const { return m_is_global; }
59
60 void Dump(const ExecutionContext *exe_ctx, Stream &strm,
61 uint32_t dump_mask) const;
62
63 bool DumpQualifiedName(Stream &strm) const;
64
65 void DumpDescription(
66 CommandInterpreter &interpreter, Stream &strm, uint32_t output_width,
67 bool display_qualified_name,
68 std::optional<Stream::HighlightSettings> highlight = std::nullopt) const;
69
70 void SetValueChangedCallback(std::function<void()> callback);
71
72protected:
73 std::string m_name;
74 std::string m_description;
77};
78
79} // namespace lldb_private
80
81#endif // LLDB_INTERPRETER_PROPERTY_H
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
llvm::StringRef GetName() const
Definition Property.h:47
bool IsGlobal() const
Definition Property.h:58
const lldb::OptionValueSP & GetValue() const
Definition Property.h:50
void SetOptionValue(const lldb::OptionValueSP &value_sp)
Definition Property.h:52
llvm::StringRef GetDescription() const
Definition Property.h:48
std::string m_name
Definition Property.h:73
lldb::OptionValueSP m_value_sp
Definition Property.h:75
void SetValueChangedCallback(std::function< void()> callback)
Definition Property.cpp:307
void DumpDescription(CommandInterpreter &interpreter, Stream &strm, uint32_t output_width, bool display_qualified_name, std::optional< Stream::HighlightSettings > highlight=std::nullopt) const
Definition Property.cpp:275
void Dump(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) const
Definition Property.cpp:247
Property(const PropertyDefinition &definition)
Definition Property.cpp:22
bool DumpQualifiedName(Stream &strm) const
Definition Property.cpp:237
std::string m_description
Definition Property.h:74
bool IsValid() const
Definition Property.h:56
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
llvm::ArrayRef< PropertyDefinition > definitions
Definition Property.h:36
OptionEnumValues enum_values
Definition Property.h:31