• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
22 namespace 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
28 class DataVisualization
29 {
30 public:
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     class ValueFormats
40     {
41     public:
42         static lldb::TypeFormatImplSP
43         GetFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic);
44 
45         static lldb::TypeFormatImplSP
46         GetFormat (const ConstString &type);
47 
48         static void
49         Add (const ConstString &type, const lldb::TypeFormatImplSP &entry);
50 
51         static bool
52         Delete (const ConstString &type);
53 
54         static void
55         Clear ();
56 
57         static void
58         LoopThrough (TypeFormatImpl::ValueCallback callback, void* callback_baton);
59 
60         static size_t
61         GetCount ();
62 
63         static lldb::TypeNameSpecifierImplSP
64         GetTypeNameSpecifierForFormatAtIndex (size_t);
65 
66         static lldb::TypeFormatImplSP
67         GetFormatAtIndex (size_t);
68     };
69 
70     static lldb::TypeSummaryImplSP
71     GetSummaryFormat(ValueObject& valobj,
72                      lldb::DynamicValueType use_dynamic);
73 
74     static lldb::TypeSummaryImplSP
75     GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);
76 
77 #ifndef LLDB_DISABLE_PYTHON
78     static lldb::SyntheticChildrenSP
79     GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp);
80 #endif
81 
82     static lldb::TypeFilterImplSP
83     GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);
84 
85 #ifndef LLDB_DISABLE_PYTHON
86     static lldb::ScriptedSyntheticChildrenSP
87     GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
88 #endif
89 
90 #ifndef LLDB_DISABLE_PYTHON
91     static lldb::SyntheticChildrenSP
92     GetSyntheticChildren(ValueObject& valobj,
93                          lldb::DynamicValueType use_dynamic);
94 #endif
95 
96     static bool
97     AnyMatches(ConstString type_name,
98                TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
99                bool only_enabled = true,
100                const char** matching_category = NULL,
101                TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
102 
103     class NamedSummaryFormats
104     {
105     public:
106         static bool
107         GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry);
108 
109         static void
110         Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry);
111 
112         static bool
113         Delete (const ConstString &type);
114 
115         static void
116         Clear ();
117 
118         static void
119         LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton);
120 
121         static uint32_t
122         GetCount ();
123     };
124 
125     class Categories
126     {
127     public:
128 
129         static bool
130         GetCategory (const ConstString &category,
131                      lldb::TypeCategoryImplSP &entry,
132                      bool allow_create = true);
133 
134         static void
135         Add (const ConstString &category);
136 
137         static bool
138         Delete (const ConstString &category);
139 
140         static void
141         Clear ();
142 
143         static void
144         Clear (const ConstString &category);
145 
146         static void
147         Enable (const ConstString& category,
148                 TypeCategoryMap::Position = TypeCategoryMap::Default);
149 
150         static void
151         Disable (const ConstString& category);
152 
153         static void
154         Enable (const lldb::TypeCategoryImplSP& category,
155                 TypeCategoryMap::Position = TypeCategoryMap::Default);
156 
157         static void
158         Disable (const lldb::TypeCategoryImplSP& category);
159 
160         static void
161         LoopThrough (FormatManager::CategoryCallback callback, void* callback_baton);
162 
163         static uint32_t
164         GetCount ();
165 
166         static lldb::TypeCategoryImplSP
167         GetCategoryAtIndex (size_t);
168     };
169 };
170 
171 
172 } // namespace lldb_private
173 
174 #endif	// lldb_DataVisualization_h_
175