LLDB mainline
TypeCategoryMap.h
Go to the documentation of this file.
1//===-- TypeCategoryMap.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_TYPECATEGORYMAP_H
10#define LLDB_DATAFORMATTERS_TYPECATEGORYMAP_H
11
12#include <functional>
13#include <list>
14#include <map>
15#include <mutex>
16
18#include "lldb/lldb-public.h"
19
23
24namespace lldb_private {
26private:
27 typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
28 typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
29
30public:
32 typedef std::map<KeyType, lldb::TypeCategoryImplSP> MapType;
33 typedef MapType::iterator MapIterator;
34 typedef std::function<bool(const lldb::TypeCategoryImplSP &)> ForEachCallback;
35
36 typedef uint32_t Position;
37
38 static const Position First = 0;
39 static const Position Default = 1;
40 static const Position Last = UINT32_MAX;
41
43
44 void Add(KeyType name, const lldb::TypeCategoryImplSP &entry);
45
46 bool Delete(KeyType name);
47
48 bool Enable(KeyType category_name, Position pos = Default);
49
50 bool Disable(KeyType category_name);
51
52 bool Enable(lldb::TypeCategoryImplSP category, Position pos = Default);
53
54 bool Disable(lldb::TypeCategoryImplSP category);
55
57
59
60 void Clear();
61
62 bool Get(KeyType name, lldb::TypeCategoryImplSP &entry);
63
64 void ForEach(ForEachCallback callback);
65
67
68 bool
69 AnyMatches(const FormattersMatchCandidate &candidate_type,
72 bool only_enabled = true, const char **matching_category = nullptr,
73 TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
74
75 uint32_t GetCount() { return m_map.size(); }
76
77 template <typename ImplSP> void Get(FormattersMatchData &, ImplSP &);
78
79private:
82
83 public:
85 : ptr(std::move(p)) {}
86
88 return ptr.get() == other.get();
89 }
90 };
91
92 std::recursive_mutex m_map_mutex;
94
97};
98} // namespace lldb_private
99
100#endif // LLDB_DATAFORMATTERS_TYPECATEGORYMAP_H
A uniqued constant string class.
Definition: ConstString.h:40
static const uint16_t ALL_ITEM_TYPES
Definition: TypeCategory.h:176
bool operator()(const lldb::TypeCategoryImplSP &other)
std::function< bool(const lldb::TypeCategoryImplSP &)> ForEachCallback
static const Position Last
std::map< KeyType, lldb::TypeCategoryImplSP > MapType
bool AnyMatches(const FormattersMatchCandidate &candidate_type, TypeCategoryImpl::FormatCategoryItems items=TypeCategoryImpl::ALL_ITEM_TYPES, bool only_enabled=true, const char **matching_category=nullptr, TypeCategoryImpl::FormatCategoryItems *matching_type=nullptr)
void Add(KeyType name, const lldb::TypeCategoryImplSP &entry)
bool Enable(KeyType category_name, Position pos=Default)
lldb::TypeCategoryImplSP GetAtIndex(uint32_t)
std::recursive_mutex m_map_mutex
ActiveCategoriesList m_active_categories
ActiveCategoriesList::iterator ActiveCategoriesIterator
bool Disable(KeyType category_name)
IFormatChangeListener * listener
static const Position Default
std::list< lldb::TypeCategoryImplSP > ActiveCategoriesList
bool Get(KeyType name, lldb::TypeCategoryImplSP &entry)
static const Position First
void ForEach(ForEachCallback callback)
#define UINT32_MAX
Definition: lldb-defines.h:19
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
Definition: lldb-forward.h:451