1 //===-- SBTypeSummary.h -------------------------------------------*- C++ 2 //-*-===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef LLDB_API_SBTYPESUMMARY_H 11 #define LLDB_API_SBTYPESUMMARY_H 12 13 #include "lldb/API/SBDefines.h" 14 15 namespace lldb_private { 16 namespace python { 17 class SWIGBridge; 18 } 19 } // namespace lldb_private 20 21 namespace lldb { 22 class LLDB_API SBTypeSummaryOptions { 23 public: 24 SBTypeSummaryOptions(); 25 26 SBTypeSummaryOptions(const lldb::SBTypeSummaryOptions &rhs); 27 28 29 ~SBTypeSummaryOptions(); 30 31 explicit operator bool() const; 32 33 bool IsValid(); 34 35 lldb::LanguageType GetLanguage(); 36 37 lldb::TypeSummaryCapping GetCapping(); 38 39 void SetLanguage(lldb::LanguageType); 40 41 void SetCapping(lldb::TypeSummaryCapping); 42 43 protected: 44 friend class SBValue; 45 friend class SBTypeSummary; 46 47 friend class lldb_private::python::SWIGBridge; 48 49 SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions &lldb_object); 50 51 lldb_private::TypeSummaryOptions *operator->(); 52 53 const lldb_private::TypeSummaryOptions *operator->() const; 54 55 lldb_private::TypeSummaryOptions *get(); 56 57 lldb_private::TypeSummaryOptions &ref(); 58 59 const lldb_private::TypeSummaryOptions &ref() const; 60 61 private: 62 std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_up; 63 }; 64 65 class SBTypeSummary { 66 public: 67 SBTypeSummary(); 68 69 // Native function summary formatter callback 70 typedef bool (*FormatCallback)(SBValue, SBTypeSummaryOptions, SBStream &); 71 72 static SBTypeSummary 73 CreateWithSummaryString(const char *data, 74 uint32_t options = 0); // see lldb::eTypeOption values 75 76 static SBTypeSummary 77 CreateWithFunctionName(const char *data, 78 uint32_t options = 0); // see lldb::eTypeOption values 79 80 static SBTypeSummary 81 CreateWithScriptCode(const char *data, 82 uint32_t options = 0); // see lldb::eTypeOption values 83 84 #ifndef SWIG 85 static SBTypeSummary CreateWithCallback(FormatCallback cb, 86 uint32_t options = 0, 87 const char *description = nullptr); 88 #endif 89 90 SBTypeSummary(const lldb::SBTypeSummary &rhs); 91 92 ~SBTypeSummary(); 93 94 explicit operator bool() const; 95 96 bool IsValid() const; 97 98 bool IsFunctionCode(); 99 100 bool IsFunctionName(); 101 102 bool IsSummaryString(); 103 104 const char *GetData(); 105 106 void SetSummaryString(const char *data); 107 108 void SetFunctionName(const char *data); 109 110 void SetFunctionCode(const char *data); 111 112 uint32_t GetOptions(); 113 114 void SetOptions(uint32_t); 115 116 bool GetDescription(lldb::SBStream &description, 117 lldb::DescriptionLevel description_level); 118 119 lldb::SBTypeSummary &operator=(const lldb::SBTypeSummary &rhs); 120 121 bool DoesPrintValue(lldb::SBValue value); 122 123 bool IsEqualTo(lldb::SBTypeSummary &rhs); 124 125 bool operator==(lldb::SBTypeSummary &rhs); 126 127 bool operator!=(lldb::SBTypeSummary &rhs); 128 129 protected: 130 friend class SBDebugger; 131 friend class SBTypeCategory; 132 friend class SBValue; 133 134 lldb::TypeSummaryImplSP GetSP(); 135 136 void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp); 137 138 lldb::TypeSummaryImplSP m_opaque_sp; 139 140 SBTypeSummary(const lldb::TypeSummaryImplSP &); 141 142 bool CopyOnWrite_Impl(); 143 144 bool ChangeSummaryType(bool want_script); 145 }; 146 147 } // namespace lldb 148 149 #endif // LLDB_API_SBTYPESUMMARY_H 150