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 { 16 class LLDB_API SBTypeSummaryOptions { 17 public: 18 SBTypeSummaryOptions(); 19 20 SBTypeSummaryOptions(const lldb::SBTypeSummaryOptions &rhs); 21 22 SBTypeSummaryOptions(const lldb_private::TypeSummaryOptions &lldb_object); 23 24 ~SBTypeSummaryOptions(); 25 26 explicit operator bool() const; 27 28 bool IsValid(); 29 30 lldb::LanguageType GetLanguage(); 31 32 lldb::TypeSummaryCapping GetCapping(); 33 34 void SetLanguage(lldb::LanguageType); 35 36 void SetCapping(lldb::TypeSummaryCapping); 37 38 protected: 39 friend class SBValue; 40 41 lldb_private::TypeSummaryOptions *operator->(); 42 43 const lldb_private::TypeSummaryOptions *operator->() const; 44 45 lldb_private::TypeSummaryOptions *get(); 46 47 lldb_private::TypeSummaryOptions &ref(); 48 49 const lldb_private::TypeSummaryOptions &ref() const; 50 51 private: 52 std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_up; 53 }; 54 55 class SBTypeSummary { 56 public: 57 SBTypeSummary(); 58 59 // Native function summary formatter callback 60 typedef bool (*FormatCallback)(SBValue, SBTypeSummaryOptions, SBStream &); 61 62 static SBTypeSummary 63 CreateWithSummaryString(const char *data, 64 uint32_t options = 0); // see lldb::eTypeOption values 65 66 static SBTypeSummary 67 CreateWithFunctionName(const char *data, 68 uint32_t options = 0); // see lldb::eTypeOption values 69 70 static SBTypeSummary 71 CreateWithScriptCode(const char *data, 72 uint32_t options = 0); // see lldb::eTypeOption values 73 74 static SBTypeSummary CreateWithCallback(FormatCallback cb, 75 uint32_t options = 0, 76 const char *description = nullptr); 77 78 SBTypeSummary(const lldb::SBTypeSummary &rhs); 79 80 ~SBTypeSummary(); 81 82 explicit operator bool() const; 83 84 bool IsValid() const; 85 86 bool IsFunctionCode(); 87 88 bool IsFunctionName(); 89 90 bool IsSummaryString(); 91 92 const char *GetData(); 93 94 void SetSummaryString(const char *data); 95 96 void SetFunctionName(const char *data); 97 98 void SetFunctionCode(const char *data); 99 100 uint32_t GetOptions(); 101 102 void SetOptions(uint32_t); 103 104 bool GetDescription(lldb::SBStream &description, 105 lldb::DescriptionLevel description_level); 106 107 lldb::SBTypeSummary &operator=(const lldb::SBTypeSummary &rhs); 108 109 bool DoesPrintValue(lldb::SBValue value); 110 111 bool IsEqualTo(lldb::SBTypeSummary &rhs); 112 113 bool operator==(lldb::SBTypeSummary &rhs); 114 115 bool operator!=(lldb::SBTypeSummary &rhs); 116 117 protected: 118 friend class SBDebugger; 119 friend class SBTypeCategory; 120 friend class SBValue; 121 122 lldb::TypeSummaryImplSP GetSP(); 123 124 void SetSP(const lldb::TypeSummaryImplSP &typefilter_impl_sp); 125 126 lldb::TypeSummaryImplSP m_opaque_sp; 127 128 SBTypeSummary(const lldb::TypeSummaryImplSP &); 129 130 bool CopyOnWrite_Impl(); 131 132 bool ChangeSummaryType(bool want_script); 133 }; 134 135 } // namespace lldb 136 137 #endif // LLDB_API_SBTYPESUMMARY_H 138