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/lldb-defines.h"
16
17#include <string>
18
19namespace lldb_private {
20
21// A structure that can be used to create a global table for all properties.
22// Property class instances can be constructed using one of these.
24 const char *name;
26 bool global; // false == this setting is a global setting by default
28 const char *default_cstr_value;
30 const char *description;
31};
32
33using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
34
35class Property {
36public:
37 Property(const PropertyDefinition &definition);
38
39 Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
40 const lldb::OptionValueSP &value_sp);
41
42 llvm::StringRef GetName() const { return m_name; }
43 llvm::StringRef GetDescription() const { return m_description; }
44
45 const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
46
47 void SetOptionValue(const lldb::OptionValueSP &value_sp) {
48 m_value_sp = value_sp;
49 }
50
51 bool IsValid() const { return (bool)m_value_sp; }
52
53 bool IsGlobal() const { return m_is_global; }
54
55 void Dump(const ExecutionContext *exe_ctx, Stream &strm,
56 uint32_t dump_mask) const;
57
58 bool DumpQualifiedName(Stream &strm) const;
59
60 void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
61 uint32_t output_width,
62 bool display_qualified_name) const;
63
64 void SetValueChangedCallback(std::function<void()> callback);
65
66protected:
67 std::string m_name;
68 std::string m_description;
71};
72
73} // namespace lldb_private
74
75#endif // LLDB_INTERPRETER_PROPERTY_H
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
llvm::StringRef GetName() const
Definition: Property.h:42
void DumpDescription(CommandInterpreter &interpreter, Stream &strm, uint32_t output_width, bool display_qualified_name) const
Definition: Property.cpp:275
bool IsGlobal() const
Definition: Property.h:53
const lldb::OptionValueSP & GetValue() const
Definition: Property.h:45
void SetOptionValue(const lldb::OptionValueSP &value_sp)
Definition: Property.h:47
llvm::StringRef GetDescription() const
Definition: Property.h:43
std::string m_name
Definition: Property.h:67
lldb::OptionValueSP m_value_sp
Definition: Property.h:69
void SetValueChangedCallback(std::function< void()> callback)
Definition: Property.cpp:306
void Dump(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) const
Definition: Property.cpp:247
bool DumpQualifiedName(Stream &strm) const
Definition: Property.cpp:237
std::string m_description
Definition: Property.h:68
bool IsValid() const
Definition: Property.h:51
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< PropertyDefinition > PropertyDefinitions
Definition: Property.h:33
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
Definition: lldb-forward.h:382
OptionEnumValues enum_values
Definition: Property.h:29
OptionValue::Type type
Definition: Property.h:25