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();
43 lldb::TypeFormatImplSP
44 DataVisualization::ValueFormats::GetFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
46 lldb::TypeFormatImplSP entry;
47 GetFormatManager().GetValueNavigator().Get(valobj, entry, use_dynamic);
51 lldb::TypeFormatImplSP
52 DataVisualization::ValueFormats::GetFormat (const ConstString &type)
54 lldb::TypeFormatImplSP entry;
55 GetFormatManager().GetValueNavigator().Get(type, entry);
60 DataVisualization::ValueFormats::Add (const ConstString &type, const lldb::TypeFormatImplSP &entry)
62 GetFormatManager().GetValueNavigator().Add(FormatManager::GetValidTypeName(type),entry);
66 DataVisualization::ValueFormats::Delete (const ConstString &type)
68 return GetFormatManager().GetValueNavigator().Delete(type);
72 DataVisualization::ValueFormats::Clear ()
74 GetFormatManager().GetValueNavigator().Clear();
78 DataVisualization::ValueFormats::LoopThrough (TypeFormatImpl::ValueCallback callback, void* callback_baton)
80 GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
84 DataVisualization::ValueFormats::GetCount ()
86 return GetFormatManager().GetValueNavigator().GetCount();
89 lldb::TypeNameSpecifierImplSP
90 DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex (size_t index)
92 return GetFormatManager().GetValueNavigator().GetTypeNameSpecifierAtIndex(index);
95 lldb::TypeFormatImplSP
96 DataVisualization::ValueFormats::GetFormatAtIndex (size_t index)
98 return GetFormatManager().GetValueNavigator().GetAtIndex(index);
101 lldb::TypeSummaryImplSP
102 DataVisualization::GetSummaryFormat (ValueObject& valobj,
103 lldb::DynamicValueType use_dynamic)
105 return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
108 lldb::TypeSummaryImplSP
109 DataVisualization::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
111 return GetFormatManager().GetSummaryForType(type_sp);
114 #ifndef LLDB_DISABLE_PYTHON
115 lldb::SyntheticChildrenSP
116 DataVisualization::GetSyntheticChildren (ValueObject& valobj,
117 lldb::DynamicValueType use_dynamic)
119 return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
123 #ifndef LLDB_DISABLE_PYTHON
124 lldb::SyntheticChildrenSP
125 DataVisualization::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
127 return GetFormatManager().GetSyntheticChildrenForType(type_sp);
131 lldb::TypeFilterImplSP
132 DataVisualization::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
134 return GetFormatManager().GetFilterForType(type_sp);
137 #ifndef LLDB_DISABLE_PYTHON
138 lldb::ScriptedSyntheticChildrenSP
139 DataVisualization::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
141 return GetFormatManager().GetSyntheticForType(type_sp);
146 DataVisualization::AnyMatches (ConstString type_name,
147 TypeCategoryImpl::FormatCategoryItems items,
149 const char** matching_category,
150 TypeCategoryImpl::FormatCategoryItems* matching_type)
152 return GetFormatManager().AnyMatches(type_name,
160 DataVisualization::Categories::GetCategory (const ConstString &category, lldb::TypeCategoryImplSP &entry,
163 entry = GetFormatManager().GetCategory(category, allow_create);
164 return (entry.get() != NULL);
168 DataVisualization::Categories::Add (const ConstString &category)
170 GetFormatManager().GetCategory(category);
174 DataVisualization::Categories::Delete (const ConstString &category)
176 GetFormatManager().DisableCategory(category);
177 return GetFormatManager().DeleteCategory(category);
181 DataVisualization::Categories::Clear ()
183 GetFormatManager().ClearCategories();
187 DataVisualization::Categories::Clear (const ConstString &category)
189 GetFormatManager().GetCategory(category)->Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
193 DataVisualization::Categories::Enable (const ConstString& category,
194 TypeCategoryMap::Position pos)
196 if (GetFormatManager().GetCategory(category)->IsEnabled())
197 GetFormatManager().DisableCategory(category);
198 GetFormatManager().EnableCategory(category, pos);
202 DataVisualization::Categories::Disable (const ConstString& category)
204 if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
205 GetFormatManager().DisableCategory(category);
209 DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
210 TypeCategoryMap::Position pos)
214 if (category->IsEnabled())
215 GetFormatManager().DisableCategory(category);
216 GetFormatManager().EnableCategory(category, pos);
221 DataVisualization::Categories::Disable (const lldb::TypeCategoryImplSP& category)
223 if (category.get() && category->IsEnabled() == true)
224 GetFormatManager().DisableCategory(category);
228 DataVisualization::Categories::LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton)
230 GetFormatManager().LoopThroughCategories(callback, callback_baton);
234 DataVisualization::Categories::GetCount ()
236 return GetFormatManager().GetCategoriesCount();
239 lldb::TypeCategoryImplSP
240 DataVisualization::Categories::GetCategoryAtIndex (size_t index)
242 return GetFormatManager().GetCategoryAtIndex(index);
246 DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry)
248 return GetFormatManager().GetNamedSummaryNavigator().Get(type,entry);
252 DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry)
254 GetFormatManager().GetNamedSummaryNavigator().Add(FormatManager::GetValidTypeName(type),entry);
258 DataVisualization::NamedSummaryFormats::Delete (const ConstString &type)
260 return GetFormatManager().GetNamedSummaryNavigator().Delete(type);
264 DataVisualization::NamedSummaryFormats::Clear ()
266 GetFormatManager().GetNamedSummaryNavigator().Clear();
270 DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
272 GetFormatManager().GetNamedSummaryNavigator().LoopThrough(callback, callback_baton);
276 DataVisualization::NamedSummaryFormats::GetCount ()
278 return GetFormatManager().GetNamedSummaryNavigator().GetCount();