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
64 Stream &strm,
65 std::optional<Stream::HighlightSettings> highlight = std::nullopt) const;
66
67 void DumpDescription(
68 CommandInterpreter &interpreter, Stream &strm, uint32_t output_width,
69 bool display_qualified_name,
70 std::optional<Stream::HighlightSettings> highlight = std::nullopt) const;
71
72 void SetValueChangedCallback(std::function<void()> callback);
73
74protected:
75 std::string m_name;
76 std::string m_description;
79};
80
81} // namespace lldb_private
82
83#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:75
lldb::OptionValueSP m_value_sp
Definition Property.h:77
bool DumpQualifiedName(Stream &strm, std::optional< Stream::HighlightSettings > highlight=std::nullopt) const
Definition Property.cpp:237
void SetValueChangedCallback(std::function< void()> callback)
Definition Property.cpp:312
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:280
void Dump(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) const
Definition Property.cpp:252
Property(const PropertyDefinition &definition)
Definition Property.cpp:22
std::string m_description
Definition Property.h:76
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