1 //===-- TypeCategoryMap.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_TypeCategoryMap_h_
11 #define lldb_TypeCategoryMap_h_
20 // Other libraries and framework includes
22 #include "lldb/lldb-public.h"
23 #include "lldb/lldb-enumerations.h"
25 #include "lldb/DataFormatters/FormattersContainer.h"
26 #include "lldb/DataFormatters/TypeCategory.h"
28 namespace lldb_private {
32 typedef ConstString KeyType;
33 typedef TypeCategoryImpl ValueType;
34 typedef ValueType::SharedPointer ValueSP;
35 typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
36 typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
39 typedef std::map<KeyType, ValueSP> MapType;
40 typedef MapType::iterator MapIterator;
41 typedef std::function<bool(const ValueSP&)> ForEachCallback;
43 typedef uint32_t Position;
45 static const Position First = 0;
46 static const Position Default = 1;
47 static const Position Last = UINT32_MAX;
49 TypeCategoryMap (IFormatChangeListener* lst);
53 const ValueSP& entry);
56 Delete (KeyType name);
59 Enable (KeyType category_name,
60 Position pos = Default);
63 Disable (KeyType category_name);
66 Enable (ValueSP category,
67 Position pos = Default);
70 Disable (ValueSP category);
73 EnableAllCategories ();
76 DisableAllCategories ();
90 ForEach (ForEachCallback callback);
92 lldb::TypeCategoryImplSP
93 GetAtIndex (uint32_t);
96 AnyMatches(ConstString type_name,
97 TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
98 bool only_enabled = true,
99 const char** matching_category = nullptr,
100 TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr);
108 lldb::TypeFormatImplSP
109 GetFormat (FormattersMatchData& match_data);
111 lldb::TypeSummaryImplSP
112 GetSummaryFormat (FormattersMatchData& match_data);
114 #ifndef LLDB_DISABLE_PYTHON
115 lldb::SyntheticChildrenSP
116 GetSyntheticChildren (FormattersMatchData& match_data);
119 lldb::TypeValidatorImplSP
120 GetValidator(FormattersMatchData& match_data);
123 class delete_matching_categories
125 lldb::TypeCategoryImplSP ptr;
127 delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
130 bool operator()(const lldb::TypeCategoryImplSP& other)
132 return ptr.get() == other.get();
136 std::recursive_mutex m_map_mutex;
137 IFormatChangeListener* listener;
140 ActiveCategoriesList m_active_categories;
147 ActiveCategoriesList& active_list ()
149 return m_active_categories;
152 std::recursive_mutex &
158 friend class FormattersContainer<KeyType, ValueType>;
159 friend class FormatManager;
161 } // namespace lldb_private
163 #endif // lldb_TypeCategoryMap_h_