DataVisualization.h revision 263363
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 22namespace 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 28class DataVisualization 29{ 30public: 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 bool 76 AnyMatches(ConstString type_name, 77 TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES, 78 bool only_enabled = true, 79 const char** matching_category = NULL, 80 TypeCategoryImpl::FormatCategoryItems* matching_type = NULL); 81 82 class NamedSummaryFormats 83 { 84 public: 85 static bool 86 GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry); 87 88 static void 89 Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry); 90 91 static bool 92 Delete (const ConstString &type); 93 94 static void 95 Clear (); 96 97 static void 98 LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton); 99 100 static uint32_t 101 GetCount (); 102 }; 103 104 class Categories 105 { 106 public: 107 108 static bool 109 GetCategory (const ConstString &category, 110 lldb::TypeCategoryImplSP &entry, 111 bool allow_create = true); 112 113 static void 114 Add (const ConstString &category); 115 116 static bool 117 Delete (const ConstString &category); 118 119 static void 120 Clear (); 121 122 static void 123 Clear (const ConstString &category); 124 125 static void 126 Enable (const ConstString& category, 127 TypeCategoryMap::Position = TypeCategoryMap::Default); 128 129 static void 130 Disable (const ConstString& category); 131 132 static void 133 Enable (const lldb::TypeCategoryImplSP& category, 134 TypeCategoryMap::Position = TypeCategoryMap::Default); 135 136 static void 137 Disable (const lldb::TypeCategoryImplSP& category); 138 139 static void 140 LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton); 141 142 static uint32_t 143 GetCount (); 144 145 static lldb::TypeCategoryImplSP 146 GetCategoryAtIndex (size_t); 147 }; 148}; 149 150 151} // namespace lldb_private 152 153#endif // lldb_DataVisualization_h_ 154