1 //===-- SBStructuredData.h --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef SBStructuredData_h
11 #define SBStructuredData_h
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBModule.h"
18 class SBStructuredData {
22 SBStructuredData(const lldb::SBStructuredData &rhs);
24 SBStructuredData(const lldb::EventSP &event_sp);
28 lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
32 lldb::SBError SetFromJSON(lldb::SBStream &stream);
36 lldb::SBError GetAsJSON(lldb::SBStream &stream) const;
38 lldb::SBError GetDescription(lldb::SBStream &stream) const;
40 //------------------------------------------------------------------
41 /// Return the type of data in this data structure
42 //------------------------------------------------------------------
43 lldb::StructuredDataType GetType() const;
45 //------------------------------------------------------------------
46 /// Return the size (i.e. number of elements) in this data structure
47 /// if it is an array or dictionary type. For other types, 0 will be
49 //------------------------------------------------------------------
50 size_t GetSize() const;
52 //------------------------------------------------------------------
53 /// Return the value corresponding to a key if this data structure
54 /// is a dictionary type.
55 //------------------------------------------------------------------
56 lldb::SBStructuredData GetValueForKey(const char *key) const;
58 //------------------------------------------------------------------
59 /// Return the value corresponding to an index if this data structure
61 //------------------------------------------------------------------
62 lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
64 //------------------------------------------------------------------
65 /// Return the integer value if this data structure is an integer type.
66 //------------------------------------------------------------------
67 uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
69 //------------------------------------------------------------------
70 /// Return the floating point value if this data structure is a floating
72 //------------------------------------------------------------------
73 double GetFloatValue(double fail_value = 0.0) const;
75 //------------------------------------------------------------------
76 /// Return the boolean value if this data structure is a boolean type.
77 //------------------------------------------------------------------
78 bool GetBooleanValue(bool fail_value = false) const;
80 //------------------------------------------------------------------
81 /// Provides the string value if this data structure is a string type.
84 /// pointer where the string value will be written. In case it is null,
85 /// nothing will be written at @dst.
87 /// @param[in] dst_len
88 /// max number of characters that can be written at @dst. In case it is
89 /// zero, nothing will be written at @dst. If this length is not enough
90 /// to write the complete string value, (dst_len-1) bytes of the string
91 /// value will be written at @dst followed by a null character.
94 /// Returns the byte size needed to completely write the string value at
95 /// @dst in all cases.
96 //------------------------------------------------------------------
97 size_t GetStringValue(char *dst, size_t dst_len) const;
100 friend class SBTraceOptions;
101 friend class SBDebugger;
102 friend class SBTarget;
104 StructuredDataImplUP m_impl_up;
108 #endif /* SBStructuredData_h */