1 //===-- DataVisualization.cpp ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
12 #include "lldb/DataFormatters/DataVisualization.h"
16 // Other libraries and framework includes
19 #include "lldb/Core/Debugger.h"
22 using namespace lldb_private;
27 static FormatManager g_format_manager;
28 return g_format_manager;
32 DataVisualization::ForceUpdate ()
34 GetFormatManager().Changed();
38 DataVisualization::GetCurrentRevision ()
40 return GetFormatManager().GetCurrentRevision();
44 DataVisualization::ShouldPrintAsOneLiner (ValueObject& valobj)
46 return GetFormatManager().ShouldPrintAsOneLiner(valobj);
49 lldb::TypeFormatImplSP
50 DataVisualization::GetFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
52 return GetFormatManager().GetFormat(valobj, use_dynamic);
55 lldb::TypeFormatImplSP
56 DataVisualization::GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp)
58 return GetFormatManager().GetFormatForType(type_sp);
61 lldb::TypeSummaryImplSP
62 DataVisualization::GetSummaryFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
64 return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
67 lldb::TypeSummaryImplSP
68 DataVisualization::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
70 return GetFormatManager().GetSummaryForType(type_sp);
73 #ifndef LLDB_DISABLE_PYTHON
74 lldb::SyntheticChildrenSP
75 DataVisualization::GetSyntheticChildren (ValueObject& valobj,
76 lldb::DynamicValueType use_dynamic)
78 return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
82 #ifndef LLDB_DISABLE_PYTHON
83 lldb::SyntheticChildrenSP
84 DataVisualization::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
86 return GetFormatManager().GetSyntheticChildrenForType(type_sp);
90 lldb::TypeFilterImplSP
91 DataVisualization::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
93 return GetFormatManager().GetFilterForType(type_sp);
96 #ifndef LLDB_DISABLE_PYTHON
97 lldb::ScriptedSyntheticChildrenSP
98 DataVisualization::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
100 return GetFormatManager().GetSyntheticForType(type_sp);
104 lldb::TypeValidatorImplSP
105 DataVisualization::GetValidator (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
107 return GetFormatManager().GetValidator(valobj, use_dynamic);
110 lldb::TypeValidatorImplSP
111 DataVisualization::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
113 return GetFormatManager().GetValidatorForType(type_sp);
117 DataVisualization::AnyMatches (ConstString type_name,
118 TypeCategoryImpl::FormatCategoryItems items,
120 const char** matching_category,
121 TypeCategoryImpl::FormatCategoryItems* matching_type)
123 return GetFormatManager().AnyMatches(type_name,
131 DataVisualization::Categories::GetCategory (const ConstString &category, lldb::TypeCategoryImplSP &entry,
134 entry = GetFormatManager().GetCategory(category, allow_create);
135 return (entry.get() != NULL);
139 DataVisualization::Categories::Add (const ConstString &category)
141 GetFormatManager().GetCategory(category);
145 DataVisualization::Categories::Delete (const ConstString &category)
147 GetFormatManager().DisableCategory(category);
148 return GetFormatManager().DeleteCategory(category);
152 DataVisualization::Categories::Clear ()
154 GetFormatManager().ClearCategories();
158 DataVisualization::Categories::Clear (const ConstString &category)
160 GetFormatManager().GetCategory(category)->Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
164 DataVisualization::Categories::Enable (const ConstString& category,
165 TypeCategoryMap::Position pos)
167 if (GetFormatManager().GetCategory(category)->IsEnabled())
168 GetFormatManager().DisableCategory(category);
169 GetFormatManager().EnableCategory(category, pos);
173 DataVisualization::Categories::Disable (const ConstString& category)
175 if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
176 GetFormatManager().DisableCategory(category);
180 DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
181 TypeCategoryMap::Position pos)
185 if (category->IsEnabled())
186 GetFormatManager().DisableCategory(category);
187 GetFormatManager().EnableCategory(category, pos);
192 DataVisualization::Categories::Disable (const lldb::TypeCategoryImplSP& category)
194 if (category.get() && category->IsEnabled() == true)
195 GetFormatManager().DisableCategory(category);
199 DataVisualization::Categories::EnableStar ()
201 GetFormatManager().EnableAllCategories ();
205 DataVisualization::Categories::DisableStar ()
207 GetFormatManager().DisableAllCategories();
211 DataVisualization::Categories::LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton)
213 GetFormatManager().LoopThroughCategories(callback, callback_baton);
217 DataVisualization::Categories::GetCount ()
219 return GetFormatManager().GetCategoriesCount();
222 lldb::TypeCategoryImplSP
223 DataVisualization::Categories::GetCategoryAtIndex (size_t index)
225 return GetFormatManager().GetCategoryAtIndex(index);
229 DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry)
231 return GetFormatManager().GetNamedSummaryContainer().Get(type,entry);
235 DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry)
237 GetFormatManager().GetNamedSummaryContainer().Add(FormatManager::GetValidTypeName(type),entry);
241 DataVisualization::NamedSummaryFormats::Delete (const ConstString &type)
243 return GetFormatManager().GetNamedSummaryContainer().Delete(type);
247 DataVisualization::NamedSummaryFormats::Clear ()
249 GetFormatManager().GetNamedSummaryContainer().Clear();
253 DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
255 GetFormatManager().GetNamedSummaryContainer().LoopThrough(callback, callback_baton);
259 DataVisualization::NamedSummaryFormats::GetCount ()
261 return GetFormatManager().GetNamedSummaryContainer().GetCount();