blob: f4aa23e9b6abf3077e56e361b8f2e37999847853 [file] [log] [blame]
Enrico Granata0a976142011-08-22 22:03:47 +00001//===-- DataVisualization.cpp ---------------------------------------*- 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#include "lldb/Core/DataVisualization.h"
11
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15// Project includes
16
17#include "lldb/Core/Debugger.h"
18
19using namespace lldb;
20using namespace lldb_private;
21
22static FormatManager&
23GetFormatManager()
24{
25 static FormatManager g_format_manager;
26 return g_format_manager;
27}
28
29void
30DataVisualization::ForceUpdate()
31{
32 GetFormatManager().Changed();
33}
34
35uint32_t
36DataVisualization::GetCurrentRevision ()
37{
38 return GetFormatManager().GetCurrentRevision();
39}
40
41bool
42DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, lldb::ValueFormatSP &entry)
43{
44 return GetFormatManager().GetValueNavigator().Get(valobj,entry, use_dynamic);
45}
46
47void
48DataVisualization::ValueFormats::Add(const ConstString &type, const lldb::ValueFormatSP &entry)
49{
50 GetFormatManager().GetValueNavigator().Add(FormatManager::GetValidTypeName(type),entry);
51}
52
53bool
54DataVisualization::ValueFormats::Delete(const ConstString &type)
55{
56 return GetFormatManager().GetValueNavigator().Delete(type);
57}
58
59void
60DataVisualization::ValueFormats::Clear()
61{
62 GetFormatManager().GetValueNavigator().Clear();
63}
64
65void
66DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
67{
68 GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
69}
70
71uint32_t
72DataVisualization::ValueFormats::GetCount()
73{
74 return GetFormatManager().GetValueNavigator().GetCount();
75}
76
77bool
78DataVisualization::GetSummaryFormat(ValueObject& valobj,
79 lldb::DynamicValueType use_dynamic,
80 lldb::SummaryFormatSP& entry)
81{
82 return GetFormatManager().Get(valobj, entry, use_dynamic);
83}
84bool
85DataVisualization::GetSyntheticChildren(ValueObject& valobj,
86 lldb::DynamicValueType use_dynamic,
87 lldb::SyntheticChildrenSP& entry)
88{
89 return GetFormatManager().Get(valobj, entry, use_dynamic);
90}
91
92bool
93DataVisualization::AnyMatches(ConstString type_name,
94 FormatCategory::FormatCategoryItems items,
95 bool only_enabled,
96 const char** matching_category,
97 FormatCategory::FormatCategoryItems* matching_type)
98{
99 return GetFormatManager().AnyMatches(type_name,
100 items,
101 only_enabled,
102 matching_category,
103 matching_type);
104}
105
106bool
107DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
108{
109 entry = GetFormatManager().Category(category);
110 return true;
111}
112
113void
114DataVisualization::Categories::Add(const ConstString &category)
115{
116 GetFormatManager().Category(category);
117}
118
119bool
120DataVisualization::Categories::Delete(const ConstString &category)
121{
122 GetFormatManager().DisableCategory(category);
123 return GetFormatManager().GetCategories().Delete(category);
124}
125
126void
127DataVisualization::Categories::Clear()
128{
129 GetFormatManager().GetCategories().Clear();
130}
131
132void
133DataVisualization::Categories::Clear(ConstString &category)
134{
135 GetFormatManager().Category(category)->ClearSummaries();
136}
137
138void
139DataVisualization::Categories::Enable(ConstString& category)
140{
141 if (GetFormatManager().Category(category)->IsEnabled() == false)
142 GetFormatManager().EnableCategory(category);
143 else
144 {
145 GetFormatManager().DisableCategory(category);
146 GetFormatManager().EnableCategory(category);
147 }
148}
149
150void
151DataVisualization::Categories::Disable(ConstString& category)
152{
153 if (GetFormatManager().Category(category)->IsEnabled() == true)
154 GetFormatManager().DisableCategory(category);
155}
156
157void
158DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
159{
160 GetFormatManager().LoopThroughCategories(callback, callback_baton);
161}
162
163uint32_t
164DataVisualization::Categories::GetCount()
165{
166 return GetFormatManager().GetCategories().GetCount();
167}
168
169bool
170DataVisualization::NamedSummaryFormats::Get(const ConstString &type, lldb::SummaryFormatSP &entry)
171{
172 return GetFormatManager().GetNamedSummaryNavigator().Get(type,entry);
173}
174
175void
176DataVisualization::NamedSummaryFormats::Add(const ConstString &type, const lldb::SummaryFormatSP &entry)
177{
178 GetFormatManager().GetNamedSummaryNavigator().Add(FormatManager::GetValidTypeName(type),entry);
179}
180
181bool
182DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
183{
184 return GetFormatManager().GetNamedSummaryNavigator().Delete(type);
185}
186
187void
188DataVisualization::NamedSummaryFormats::Clear()
189{
190 GetFormatManager().GetNamedSummaryNavigator().Clear();
191}
192
193void
194DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
195{
196 GetFormatManager().GetNamedSummaryNavigator().LoopThrough(callback, callback_baton);
197}
198
199uint32_t
200DataVisualization::NamedSummaryFormats::GetCount()
201{
202 return GetFormatManager().GetNamedSummaryNavigator().GetCount();
203}