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
24#include "llvm/ADT/StringMap.h"
25
26namespace lldb_private {
28private:
29 typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
30 typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
31
32public:
33 typedef llvm::StringMap<lldb::TypeCategoryImplSP> MapType;
34 typedef MapType::iterator MapIterator;
35 typedef std::function<bool(const lldb::TypeCategoryImplSP &)> ForEachCallback;
36
37 typedef uint32_t Position;
38
39 static const Position First = 0;
40 static const Position Default = 1;
41 static const Position Last = UINT32_MAX;
42
44
45 void Add(llvm::StringRef name, const lldb::TypeCategoryImplSP &entry);
46
47 bool Delete(llvm::StringRef name);
48
49 bool Enable(llvm::StringRef category_name, Position pos = Default);
50
51 bool Disable(llvm::StringRef category_name);
52
53 bool Enable(lldb::TypeCategoryImplSP category, Position pos = Default);
54
55 bool Disable(lldb::TypeCategoryImplSP category);
56
58
60
61 void Clear();
62
63 bool Get(llvm::StringRef name, lldb::TypeCategoryImplSP &entry);
64
65 void ForEach(ForEachCallback callback);
66
68
69 uint32_t GetCount() { return m_map.size(); }
70
71 template <typename ImplSP> void Get(FormattersMatchData &, ImplSP &);
72
73private:
76
77 public:
80
82 return ptr.get() == other.get();
83 }
84 };
85
86 std::recursive_mutex m_map_mutex;
88
91};
92} // namespace lldb_private
93
94#endif // LLDB_DATAFORMATTERS_TYPECATEGORYMAP_H
bool operator()(const lldb::TypeCategoryImplSP &other)
bool Enable(llvm::StringRef category_name, Position pos=Default)
bool Disable(llvm::StringRef category_name)
std::function< bool(const lldb::TypeCategoryImplSP &)> ForEachCallback
static const Position Last
lldb::TypeCategoryImplSP GetAtIndex(uint32_t)
std::recursive_mutex m_map_mutex
bool Delete(llvm::StringRef name)
ActiveCategoriesList m_active_categories
ActiveCategoriesList::iterator ActiveCategoriesIterator
bool Get(llvm::StringRef name, lldb::TypeCategoryImplSP &entry)
IFormatChangeListener * listener
static const Position Default
std::list< lldb::TypeCategoryImplSP > ActiveCategoriesList
llvm::StringMap< lldb::TypeCategoryImplSP > MapType
void Add(llvm::StringRef name, const lldb::TypeCategoryImplSP &entry)
static const Position First
void ForEach(ForEachCallback callback)
TypeCategoryMap(IFormatChangeListener *lst)
#define UINT32_MAX
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP