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
34 llvm::ArrayRef<PropertyDefinition> definitions;
35 llvm::StringRef expected_path;
36};
37
38class Property {
39public:
40 Property(const PropertyDefinition &definition);
41
42 Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
43 const lldb::OptionValueSP &value_sp);
44
45 llvm::StringRef GetName() const { return m_name; }
46 llvm::StringRef GetDescription() const { return m_description; }
47
48 const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
49
50 void SetOptionValue(const lldb::OptionValueSP &value_sp) {
51 m_value_sp = value_sp;
52 }
53
54 bool IsValid() const { return (bool)m_value_sp; }
55
56 bool IsGlobal() const { return m_is_global; }
57
58 void Dump(const ExecutionContext *exe_ctx, Stream &strm,
59 uint32_t dump_mask) const;
60
61 bool DumpQualifiedName(Stream &strm) const;
62
63 void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
64 uint32_t output_width,
65 bool display_qualified_name) const;
66
67 void SetValueChangedCallback(std::function<void()> callback);
68
69protected:
70 std::string m_name;
71 std::string m_description;
74};
75
76} // namespace lldb_private
77
78#endif // LLDB_INTERPRETER_PROPERTY_H
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
llvm::StringRef GetName() const
Definition Property.h:45
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:56
const lldb::OptionValueSP & GetValue() const
Definition Property.h:48
void SetOptionValue(const lldb::OptionValueSP &value_sp)
Definition Property.h:50
llvm::StringRef GetDescription() const
Definition Property.h:46
std::string m_name
Definition Property.h:70
lldb::OptionValueSP m_value_sp
Definition Property.h:72
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
Property(const PropertyDefinition &definition)
Definition Property.cpp:22
bool DumpQualifiedName(Stream &strm) const
Definition Property.cpp:237
std::string m_description
Definition Property.h:71
bool IsValid() const
Definition Property.h:54
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:34
OptionEnumValues enum_values
Definition Property.h:29