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);
105 DataVisualization::AnyMatches (ConstString type_name,
106 TypeCategoryImpl::FormatCategoryItems items,
108 const char** matching_category,
109 TypeCategoryImpl::FormatCategoryItems* matching_type)
111 return GetFormatManager().AnyMatches(type_name,
119 DataVisualization::Categories::GetCategory (const ConstString &category, lldb::TypeCategoryImplSP &entry,
122 entry = GetFormatManager().GetCategory(category, allow_create);
123 return (entry.get() != NULL);
127 DataVisualization::Categories::Add (const ConstString &category)
129 GetFormatManager().GetCategory(category);
133 DataVisualization::Categories::Delete (const ConstString &category)
135 GetFormatManager().DisableCategory(category);
136 return GetFormatManager().DeleteCategory(category);
140 DataVisualization::Categories::Clear ()
142 GetFormatManager().ClearCategories();
146 DataVisualization::Categories::Clear (const ConstString &category)
148 GetFormatManager().GetCategory(category)->Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
152 DataVisualization::Categories::Enable (const ConstString& category,
153 TypeCategoryMap::Position pos)
155 if (GetFormatManager().GetCategory(category)->IsEnabled())
156 GetFormatManager().DisableCategory(category);
157 GetFormatManager().EnableCategory(category, pos);
161 DataVisualization::Categories::Disable (const ConstString& category)
163 if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
164 GetFormatManager().DisableCategory(category);
168 DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
169 TypeCategoryMap::Position pos)
173 if (category->IsEnabled())
174 GetFormatManager().DisableCategory(category);
175 GetFormatManager().EnableCategory(category, pos);
180 DataVisualization::Categories::Disable (const lldb::TypeCategoryImplSP& category)
182 if (category.get() && category->IsEnabled() == true)
183 GetFormatManager().DisableCategory(category);
187 DataVisualization::Categories::LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton)
189 GetFormatManager().LoopThroughCategories(callback, callback_baton);
193 DataVisualization::Categories::GetCount ()
195 return GetFormatManager().GetCategoriesCount();
198 lldb::TypeCategoryImplSP
199 DataVisualization::Categories::GetCategoryAtIndex (size_t index)
201 return GetFormatManager().GetCategoryAtIndex(index);
205 DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry)
207 return GetFormatManager().GetNamedSummaryContainer().Get(type,entry);
211 DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry)
213 GetFormatManager().GetNamedSummaryContainer().Add(FormatManager::GetValidTypeName(type),entry);
217 DataVisualization::NamedSummaryFormats::Delete (const ConstString &type)
219 return GetFormatManager().GetNamedSummaryContainer().Delete(type);
223 DataVisualization::NamedSummaryFormats::Clear ()
225 GetFormatManager().GetNamedSummaryContainer().Clear();
229 DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
231 GetFormatManager().GetNamedSummaryContainer().LoopThrough(callback, callback_baton);
235 DataVisualization::NamedSummaryFormats::GetCount ()
237 return GetFormatManager().GetNamedSummaryContainer().GetCount();