1 //===-- DataVisualization.h -------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef lldb_DataVisualization_h_ 11 #define lldb_DataVisualization_h_ 12 13 // C Includes 14 // C++ Includes 15 16 // Other libraries and framework includes 17 // Project includes 18 #include "lldb/Core/ConstString.h" 19 #include "lldb/DataFormatters/FormatClasses.h" 20 #include "lldb/DataFormatters/FormatManager.h" 21 22 namespace lldb_private { 23 24 // this class is the high-level front-end of LLDB Data Visualization 25 // code in FormatManager.h/cpp is the low-level implementation of this feature 26 // clients should refer to this class as the entry-point into the data formatters 27 // unless they have a good reason to bypass this and go to the backend 28 class DataVisualization 29 { 30 public: 31 // use this call to force the FM to consider itself updated even when there is no apparent reason for that 32 static void 33 ForceUpdate(); 34 35 static uint32_t 36 GetCurrentRevision (); 37 38 static bool 39 ShouldPrintAsOneLiner (ValueObject& valobj); 40 41 static lldb::TypeFormatImplSP 42 GetFormat (ValueObject& valobj, 43 lldb::DynamicValueType use_dynamic); 44 45 static lldb::TypeFormatImplSP 46 GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp); 47 48 static lldb::TypeSummaryImplSP 49 GetSummaryFormat (ValueObject& valobj, 50 lldb::DynamicValueType use_dynamic); 51 52 static lldb::TypeSummaryImplSP 53 GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp); 54 55 #ifndef LLDB_DISABLE_PYTHON 56 static lldb::SyntheticChildrenSP 57 GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp); 58 #endif 59 60 static lldb::TypeFilterImplSP 61 GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp); 62 63 #ifndef LLDB_DISABLE_PYTHON 64 static lldb::ScriptedSyntheticChildrenSP 65 GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp); 66 #endif 67 68 #ifndef LLDB_DISABLE_PYTHON 69 static lldb::SyntheticChildrenSP 70 GetSyntheticChildren(ValueObject& valobj, 71 lldb::DynamicValueType use_dynamic); 72 #endif 73 74 static lldb::TypeValidatorImplSP 75 GetValidator (ValueObject& valobj, 76 lldb::DynamicValueType use_dynamic); 77 78 static lldb::TypeValidatorImplSP 79 GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp); 80 81 static bool 82 AnyMatches(ConstString type_name, 83 TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES, 84 bool only_enabled = true, 85 const char** matching_category = nullptr, 86 TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr); 87 88 class NamedSummaryFormats 89 { 90 public: 91 static bool 92 GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry); 93 94 static void 95 Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry); 96 97 static bool 98 Delete (const ConstString &type); 99 100 static void 101 Clear (); 102 103 static void 104 ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback); 105 106 static uint32_t 107 GetCount (); 108 }; 109 110 class Categories 111 { 112 public: 113 static bool 114 GetCategory (const ConstString &category, 115 lldb::TypeCategoryImplSP &entry, 116 bool allow_create = true); 117 118 static bool 119 GetCategory (lldb::LanguageType language, 120 lldb::TypeCategoryImplSP &entry); 121 122 static void 123 Add (const ConstString &category); 124 125 static bool 126 Delete (const ConstString &category); 127 128 static void 129 Clear (); 130 131 static void 132 Clear (const ConstString &category); 133 134 static void 135 Enable (const ConstString& category, 136 TypeCategoryMap::Position = TypeCategoryMap::Default); 137 138 static void 139 Enable (lldb::LanguageType lang_type); 140 141 static void 142 Disable (const ConstString& category); 143 144 static void 145 Disable (lldb::LanguageType lang_type); 146 147 static void 148 Enable (const lldb::TypeCategoryImplSP& category, 149 TypeCategoryMap::Position = TypeCategoryMap::Default); 150 151 static void 152 Disable (const lldb::TypeCategoryImplSP& category); 153 154 static void 155 EnableStar (); 156 157 static void 158 DisableStar (); 159 160 static void 161 ForEach (TypeCategoryMap::ForEachCallback callback); 162 163 static uint32_t 164 GetCount (); 165 166 static lldb::TypeCategoryImplSP 167 GetCategoryAtIndex (size_t); 168 }; 169 }; 170 171 } // namespace lldb_private 172 173 #endif// lldb_DataVisualization_h_ 174