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 32 // use this call to force the FM to consider itself updated even when there is no apparent reason for that 33 static void 34 ForceUpdate(); 35 36 static uint32_t 37 GetCurrentRevision (); 38 39 static bool 40 ShouldPrintAsOneLiner (ValueObject& valobj); 41 42 static lldb::TypeFormatImplSP 43 GetFormat (ValueObject& valobj, 44 lldb::DynamicValueType use_dynamic); 45 46 static lldb::TypeFormatImplSP 47 GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp); 48 49 static lldb::TypeSummaryImplSP 50 GetSummaryFormat (ValueObject& valobj, 51 lldb::DynamicValueType use_dynamic); 52 53 static lldb::TypeSummaryImplSP 54 GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp); 55 56 #ifndef LLDB_DISABLE_PYTHON 57 static lldb::SyntheticChildrenSP 58 GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp); 59 #endif 60 61 static lldb::TypeFilterImplSP 62 GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp); 63 64 #ifndef LLDB_DISABLE_PYTHON 65 static lldb::ScriptedSyntheticChildrenSP 66 GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp); 67 #endif 68 69 #ifndef LLDB_DISABLE_PYTHON 70 static lldb::SyntheticChildrenSP 71 GetSyntheticChildren(ValueObject& valobj, 72 lldb::DynamicValueType use_dynamic); 73 #endif 74 75 static lldb::TypeValidatorImplSP 76 GetValidator (ValueObject& valobj, 77 lldb::DynamicValueType use_dynamic); 78 79 static lldb::TypeValidatorImplSP 80 GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp); 81 82 static bool 83 AnyMatches(ConstString type_name, 84 TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES, 85 bool only_enabled = true, 86 const char** matching_category = NULL, 87 TypeCategoryImpl::FormatCategoryItems* matching_type = NULL); 88 89 class NamedSummaryFormats 90 { 91 public: 92 static bool 93 GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry); 94 95 static void 96 Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry); 97 98 static bool 99 Delete (const ConstString &type); 100 101 static void 102 Clear (); 103 104 static void 105 LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton); 106 107 static uint32_t 108 GetCount (); 109 }; 110 111 class Categories 112 { 113 public: 114 115 static bool 116 GetCategory (const ConstString &category, 117 lldb::TypeCategoryImplSP &entry, 118 bool allow_create = true); 119 120 static void 121 Add (const ConstString &category); 122 123 static bool 124 Delete (const ConstString &category); 125 126 static void 127 Clear (); 128 129 static void 130 Clear (const ConstString &category); 131 132 static void 133 Enable (const ConstString& category, 134 TypeCategoryMap::Position = TypeCategoryMap::Default); 135 136 static void 137 Disable (const ConstString& category); 138 139 static void 140 Enable (const lldb::TypeCategoryImplSP& category, 141 TypeCategoryMap::Position = TypeCategoryMap::Default); 142 143 static void 144 Disable (const lldb::TypeCategoryImplSP& category); 145 146 static void 147 EnableStar (); 148 149 static void 150 DisableStar (); 151 152 static void 153 LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton); 154 155 static uint32_t 156 GetCount (); 157 158 static lldb::TypeCategoryImplSP 159 GetCategoryAtIndex (size_t); 160 }; 161 }; 162 163 164 } // namespace lldb_private 165 166 #endif // lldb_DataVisualization_h_ 167