1 //===-- DataVisualization.h -------------------------------------*- 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 #ifndef lldb_DataVisualization_h_
11 #define lldb_DataVisualization_h_
16 // Other libraries and framework includes
18 #include "lldb/DataFormatters/FormatClasses.h"
19 #include "lldb/DataFormatters/FormatManager.h"
20 #include "lldb/Utility/ConstString.h"
22 namespace lldb_private {
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
28 // unless they have a good reason to bypass this and go to the backend
29 class DataVisualization {
31 // use this call to force the FM to consider itself updated even when there is
32 // no apparent reason for that
33 static void ForceUpdate();
35 static uint32_t GetCurrentRevision();
37 static bool ShouldPrintAsOneLiner(ValueObject &valobj);
39 static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
40 lldb::DynamicValueType use_dynamic);
42 static lldb::TypeFormatImplSP
43 GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
45 static lldb::TypeSummaryImplSP
46 GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
48 static lldb::TypeSummaryImplSP
49 GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
51 #ifndef LLDB_DISABLE_PYTHON
52 static lldb::SyntheticChildrenSP
53 GetSyntheticChildrenForType(lldb::TypeNameSpecifierImplSP type_sp);
56 static lldb::TypeFilterImplSP
57 GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
59 #ifndef LLDB_DISABLE_PYTHON
60 static lldb::ScriptedSyntheticChildrenSP
61 GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
64 #ifndef LLDB_DISABLE_PYTHON
65 static lldb::SyntheticChildrenSP
66 GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
69 static lldb::TypeValidatorImplSP
70 GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
72 static lldb::TypeValidatorImplSP
73 GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
76 AnyMatches(ConstString type_name,
77 TypeCategoryImpl::FormatCategoryItems items =
78 TypeCategoryImpl::ALL_ITEM_TYPES,
79 bool only_enabled = true, const char **matching_category = nullptr,
80 TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
82 class NamedSummaryFormats {
84 static bool GetSummaryFormat(const ConstString &type,
85 lldb::TypeSummaryImplSP &entry);
87 static void Add(const ConstString &type,
88 const lldb::TypeSummaryImplSP &entry);
90 static bool Delete(const ConstString &type);
95 ForEach(std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
98 static uint32_t GetCount();
103 static bool GetCategory(const ConstString &category,
104 lldb::TypeCategoryImplSP &entry,
105 bool allow_create = true);
107 static bool GetCategory(lldb::LanguageType language,
108 lldb::TypeCategoryImplSP &entry);
110 static void Add(const ConstString &category);
112 static bool Delete(const ConstString &category);
116 static void Clear(const ConstString &category);
118 static void Enable(const ConstString &category,
119 TypeCategoryMap::Position = TypeCategoryMap::Default);
121 static void Enable(lldb::LanguageType lang_type);
123 static void Disable(const ConstString &category);
125 static void Disable(lldb::LanguageType lang_type);
127 static void Enable(const lldb::TypeCategoryImplSP &category,
128 TypeCategoryMap::Position = TypeCategoryMap::Default);
130 static void Disable(const lldb::TypeCategoryImplSP &category);
132 static void EnableStar();
134 static void DisableStar();
136 static void ForEach(TypeCategoryMap::ForEachCallback callback);
138 static uint32_t GetCount();
140 static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t);
144 } // namespace lldb_private
146 #endif // lldb_DataVisualization_h_