1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
//===-- TypeCategoryMap.h ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef lldb_TypeCategoryMap_h_
#define lldb_TypeCategoryMap_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/DataFormatters/FormatNavigator.h"
#include "lldb/DataFormatters/TypeCategory.h"
namespace lldb_private {
class TypeCategoryMap
{
private:
typedef ConstString KeyType;
typedef TypeCategoryImpl ValueType;
typedef ValueType::SharedPointer ValueSP;
typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
public:
typedef std::map<KeyType, ValueSP> MapType;
typedef MapType::iterator MapIterator;
typedef bool(*CallbackType)(void*, const ValueSP&);
typedef uint32_t Position;
static const Position First = 0;
static const Position Default = 1;
static const Position Last = UINT32_MAX;
TypeCategoryMap (IFormatChangeListener* lst);
void
Add (KeyType name,
const ValueSP& entry);
bool
Delete (KeyType name);
bool
Enable (KeyType category_name,
Position pos = Default);
bool
Disable (KeyType category_name);
bool
Enable (ValueSP category,
Position pos = Default);
bool
Disable (ValueSP category);
void
Clear ();
bool
Get (KeyType name,
ValueSP& entry);
bool
Get (uint32_t pos,
ValueSP& entry);
void
LoopThrough (CallbackType callback, void* param);
lldb::TypeCategoryImplSP
GetAtIndex (uint32_t);
bool
AnyMatches (ConstString type_name,
TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
bool only_enabled = true,
const char** matching_category = NULL,
TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
uint32_t
GetCount ()
{
return m_map.size();
}
lldb::TypeSummaryImplSP
GetSummaryFormat (ValueObject& valobj,
lldb::DynamicValueType use_dynamic);
#ifndef LLDB_DISABLE_PYTHON
lldb::SyntheticChildrenSP
GetSyntheticChildren (ValueObject& valobj,
lldb::DynamicValueType use_dynamic);
#endif
private:
class delete_matching_categories
{
lldb::TypeCategoryImplSP ptr;
public:
delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
{}
bool operator()(const lldb::TypeCategoryImplSP& other)
{
return ptr.get() == other.get();
}
};
Mutex m_map_mutex;
IFormatChangeListener* listener;
MapType m_map;
ActiveCategoriesList m_active_categories;
MapType& map ()
{
return m_map;
}
ActiveCategoriesList& active_list ()
{
return m_active_categories;
}
Mutex& mutex ()
{
return m_map_mutex;
}
friend class FormatNavigator<KeyType, ValueType>;
friend class FormatManager;
};
} // namespace lldb_private
#endif // lldb_TypeCategoryMap_h_
|