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