1//===-- DataVisualization.h -------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
10#define LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
11
12#include "lldb/DataFormatters/FormatClasses.h"
13#include "lldb/DataFormatters/FormatManager.h"
14#include "lldb/Utility/ConstString.h"
15
16namespace lldb_private {
17
18// this class is the high-level front-end of LLDB Data Visualization code in
19// FormatManager.h/cpp is the low-level implementation of this feature clients
20// should refer to this class as the entry-point into the data formatters
21// unless they have a good reason to bypass this and go to the backend
22class DataVisualization {
23public:
24 // use this call to force the FM to consider itself updated even when there
25 // is no apparent reason for that
26 static void ForceUpdate();
27
28 static uint32_t GetCurrentRevision();
29
30 static bool ShouldPrintAsOneLiner(ValueObject &valobj);
31
32 static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
33 lldb::DynamicValueType use_dynamic);
34
35 static lldb::TypeFormatImplSP
36 GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
37
38 static lldb::TypeSummaryImplSP
39 GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
40
41 static lldb::TypeSummaryImplSP
42 GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
43
44 static lldb::TypeFilterImplSP
45 GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
46
47 static lldb::ScriptedSyntheticChildrenSP
48 GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
49
50 static lldb::SyntheticChildrenSP
51 GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
52
53 static bool
54 AnyMatches(ConstString type_name,
55 TypeCategoryImpl::FormatCategoryItems items =
56 TypeCategoryImpl::ALL_ITEM_TYPES,
57 bool only_enabled = true, const char **matching_category = nullptr,
58 TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
59
60 class NamedSummaryFormats {
61 public:
62 static bool GetSummaryFormat(ConstString type,
63 lldb::TypeSummaryImplSP &entry);
64
65 static void Add(ConstString type,
66 const lldb::TypeSummaryImplSP &entry);
67
68 static bool Delete(ConstString type);
69
70 static void Clear();
71
72 static void ForEach(std::function<bool(const TypeMatcher &,
73 const lldb::TypeSummaryImplSP &)>
74 callback);
75
76 static uint32_t GetCount();
77 };
78
79 class Categories {
80 public:
81 static bool GetCategory(ConstString category,
82 lldb::TypeCategoryImplSP &entry,
83 bool allow_create = true);
84
85 static bool GetCategory(lldb::LanguageType language,
86 lldb::TypeCategoryImplSP &entry);
87
88 static void Add(ConstString category);
89
90 static bool Delete(ConstString category);
91
92 static void Clear();
93
94 static void Clear(ConstString category);
95
96 static void Enable(ConstString category,
97 TypeCategoryMap::Position = TypeCategoryMap::Default);
98
99 static void Enable(lldb::LanguageType lang_type);
100
101 static void Disable(ConstString category);
102
103 static void Disable(lldb::LanguageType lang_type);
104
105 static void Enable(const lldb::TypeCategoryImplSP &category,
106 TypeCategoryMap::Position = TypeCategoryMap::Default);
107
108 static void Disable(const lldb::TypeCategoryImplSP &category);
109
110 static void EnableStar();
111
112 static void DisableStar();
113
114 static void ForEach(TypeCategoryMap::ForEachCallback callback);
115
116 static uint32_t GetCount();
117
118 static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t);
119 };
120};
121
122} // namespace lldb_private
123
124#endif // LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
125