LLDB mainline
SBStructuredData.h
Go to the documentation of this file.
1//===-- SBStructuredData.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_API_SBSTRUCTUREDDATA_H
10#define LLDB_API_SBSTRUCTUREDDATA_H
11
12#include "lldb/API/SBDefines.h"
13#include "lldb/API/SBModule.h"
15
16namespace lldb_private {
17namespace python {
18class SWIGBridge;
19}
20namespace lua {
21class SWIGBridge;
22}
23} // namespace lldb_private
24
25namespace lldb {
26
28public:
30
32
34 const lldb::SBDebugger &debugger);
35
37
39
40 explicit operator bool() const;
41
42 bool IsValid() const;
43
45
46 lldb::SBError SetFromJSON(const char *json);
47
48 void Clear();
49
51
53
54 /// Return the type of data in this data structure
56
57 /// Return the size (i.e. number of elements) in this data structure
58 /// if it is an array or dictionary type. For other types, 0 will be
59 // returned.
60 size_t GetSize() const;
61
62 /// Fill keys with the keys in this object and return true if this data
63 /// structure is a dictionary. Returns false otherwise.
64 bool GetKeys(lldb::SBStringList &keys) const;
65
66 /// Return the value corresponding to a key if this data structure
67 /// is a dictionary type.
68 lldb::SBStructuredData GetValueForKey(const char *key) const;
69
70 /// Return the value corresponding to an index if this data structure
71 /// is array.
72 lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
73
74 /// Return the integer value if this data structure is an integer type.
75 uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0) const;
76 /// Return the integer value if this data structure is an integer type.
77 int64_t GetSignedIntegerValue(int64_t fail_value = 0) const;
78
80 "Specify if the value is signed or unsigned",
81 "uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)")
82 uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
83
84 /// Return the floating point value if this data structure is a floating
85 /// type.
86 double GetFloatValue(double fail_value = 0.0) const;
87
88 /// Return the boolean value if this data structure is a boolean type.
89 bool GetBooleanValue(bool fail_value = false) const;
90
91 /// Provides the string value if this data structure is a string type.
92 ///
93 /// \param[out] dst
94 /// pointer where the string value will be written. In case it is null,
95 /// nothing will be written at \a dst.
96 ///
97 /// \param[in] dst_len
98 /// max number of characters that can be written at \a dst. In case it is
99 /// zero, nothing will be written at \a dst. If this length is not enough
100 /// to write the complete string value, (\a dst_len - 1) bytes of the
101 /// string value will be written at \a dst followed by a null character.
102 ///
103 /// \return
104 /// Returns the byte size needed to completely write the string value at
105 /// \a dst in all cases.
106 size_t GetStringValue(char *dst, size_t dst_len) const;
107
108 /// Return the generic pointer if this data structure is a generic type.
110
111protected:
112 friend class SBAttachInfo;
113 friend class SBLaunchInfo;
114 friend class SBDebugger;
115 friend class SBTarget;
116 friend class SBProcess;
117 friend class SBThread;
118 friend class SBThreadPlan;
119 friend class SBBreakpoint;
121 friend class SBBreakpointName;
122 friend class SBTrace;
123 friend class lldb_private::python::SWIGBridge;
124 friend class lldb_private::lua::SWIGBridge;
126
127 SBStructuredData(const lldb_private::StructuredDataImpl &impl);
128
129 SBStructuredData(const lldb::EventSP &event_sp);
130
132};
133} // namespace lldb
134
135#endif // LLDB_API_SBSTRUCTUREDDATA_H
lldb::SBStructuredData GetItemAtIndex(size_t idx) const
Return the value corresponding to an index if this data structure is array.
lldb::SBStructuredData & operator=(const lldb::SBStructuredData &rhs)
int64_t GetSignedIntegerValue(int64_t fail_value=0) const
Return the integer value if this data structure is an integer type.
lldb::SBError GetDescription(lldb::SBStream &stream) const
friend class lldb_private::python::SWIGBridge
size_t GetStringValue(char *dst, size_t dst_len) const
Provides the string value if this data structure is a string type.
lldb::SBScriptObject GetGenericValue() const
Return the generic pointer if this data structure is a generic type.
bool GetBooleanValue(bool fail_value=false) const
Return the boolean value if this data structure is a boolean type.
StructuredDataImplUP m_impl_up
LLDB_DEPRECATED_FIXME("Specify if the value is signed or unsigned", "uint64_t GetUnsignedIntegerValue(uint64_t fail_value = 0)") uint64_t GetIntegerValue(uint64_t fail_value=0) const
lldb::StructuredDataType GetType() const
Return the type of data in this data structure.
uint64_t GetUnsignedIntegerValue(uint64_t fail_value=0) const
Return the integer value if this data structure is an integer type.
size_t GetSize() const
Return the size (i.e.
bool GetKeys(lldb::SBStringList &keys) const
Fill keys with the keys in this object and return true if this data structure is a dictionary.
lldb::SBError GetAsJSON(lldb::SBStream &stream) const
lldb::SBStructuredData GetValueForKey(const char *key) const
Return the value corresponding to a key if this data structure is a dictionary type.
lldb::SBError SetFromJSON(lldb::SBStream &stream)
double GetFloatValue(double fail_value=0.0) const
Return the floating point value if this data structure is a floating type.
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Event > EventSP
Definition: lldb-forward.h:341
std::unique_ptr< lldb_private::StructuredDataImpl > StructuredDataImplUP
Definition: lldb-forward.h:430