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_
19 // Other libraries and framework includes
21 #include "lldb/lldb-public.h"
22 #include "lldb/lldb-enumerations.h"
24 #include "lldb/DataFormatters/FormattersContainer.h"
25 #include "lldb/DataFormatters/TypeCategory.h"
27 namespace lldb_private {
31 typedef ConstString KeyType;
32 typedef TypeCategoryImpl ValueType;
33 typedef ValueType::SharedPointer ValueSP;
34 typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
35 typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
38 typedef std::map<KeyType, ValueSP> MapType;
39 typedef MapType::iterator MapIterator;
40 typedef std::function<bool(const ValueSP&)> ForEachCallback;
42 typedef uint32_t Position;
44 static const Position First = 0;
45 static const Position Default = 1;
46 static const Position Last = UINT32_MAX;
48 TypeCategoryMap (IFormatChangeListener* lst);
52 const ValueSP& entry);
55 Delete (KeyType name);
58 Enable (KeyType category_name,
59 Position pos = Default);
62 Disable (KeyType category_name);
65 Enable (ValueSP category,
66 Position pos = Default);
69 Disable (ValueSP category);
72 EnableAllCategories ();
75 DisableAllCategories ();
89 ForEach (ForEachCallback callback);
91 lldb::TypeCategoryImplSP
92 GetAtIndex (uint32_t);
95 AnyMatches(ConstString type_name,
96 TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
97 bool only_enabled = true,
98 const char** matching_category = nullptr,
99 TypeCategoryImpl::FormatCategoryItems* matching_type = nullptr);
107 lldb::TypeFormatImplSP
108 GetFormat (FormattersMatchData& match_data);
110 lldb::TypeSummaryImplSP
111 GetSummaryFormat (FormattersMatchData& match_data);
113 #ifndef LLDB_DISABLE_PYTHON
114 lldb::SyntheticChildrenSP
115 GetSyntheticChildren (FormattersMatchData& match_data);
118 lldb::TypeValidatorImplSP
119 GetValidator(FormattersMatchData& match_data);
122 class delete_matching_categories
124 lldb::TypeCategoryImplSP ptr;
126 delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
129 bool operator()(const lldb::TypeCategoryImplSP& other)
131 return ptr.get() == other.get();
136 IFormatChangeListener* listener;
139 ActiveCategoriesList m_active_categories;
146 ActiveCategoriesList& active_list ()
148 return m_active_categories;
156 friend class FormattersContainer<KeyType, ValueType>;
157 friend class FormatManager;
159 } // namespace lldb_private
161 #endif // lldb_TypeCategoryMap_h_