19 : m_map_mutex(), listener(lst), m_map(), m_active_categories() {
23 Add(default_cs, default_sp);
28 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
35 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
37 if (iter ==
m_map.end())
47 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
49 if (!
Get(category_name, category))
51 return Enable(category, pos);
55 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
57 if (!
Get(category_name, category))
63 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
78 category->Enable(
true, pos);
85 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
95 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
97 MapType::iterator iter =
m_map.begin(), end =
m_map.end();
98 for (; iter != end; ++iter) {
99 if (iter->second->IsEnabled())
101 auto pos = iter->second->GetLastEnabledPosition();
102 if (pos >= sorted_categories.size()) {
103 auto iter = std::find_if(
104 sorted_categories.begin(), sorted_categories.end(),
106 pos = std::distance(sorted_categories.begin(), iter);
108 sorted_categories.at(pos) = iter->second;
110 decltype(sorted_categories)::iterator viter = sorted_categories.begin(),
111 vend = sorted_categories.end();
112 for (; viter != vend; viter++)
118 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
126 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
134 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
136 if (iter ==
m_map.end())
138 entry = iter->second;
145 const char **matching_category,
147 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
150 for (pos =
m_map.begin(); pos != end; pos++) {
151 if (pos->second->AnyMatches(candidate_type, items, only_enabled,
152 matching_category, matching_type))
158template <
typename ImplSP>
160 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
170 "[%s] candidate match = %s %s %s %s",
172 match.GetTypeName().GetCString(),
173 match.DidStripPointer() ?
"strip-pointers" :
"no-strip-pointers",
174 match.DidStripReference() ?
"strip-reference" :
"no-strip-reference",
175 match.DidStripTypedef() ?
"strip-typedef" :
"no-strip-typedef");
181 ImplSP current_format;
182 LLDB_LOGF(log,
"[%s] Trying to use category %s", __FUNCTION__,
183 category_sp->GetName());
184 if (!category_sp->Get(
189 retval = std::move(current_format);
192 LLDB_LOGF(log,
"[%s] nothing found - returning empty SP", __FUNCTION__);
203template void TypeCategoryMap::Get<lldb::SyntheticChildrenSP>(
209 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
216 if (!callback(category))
224 for (pos =
m_map.begin(); pos != end; pos++) {
225 if (pos->second->IsEnabled())
227 if (!callback(pos->second))
235 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
237 if (index <
m_map.size()) {
239 for (pos =
m_map.begin(); pos != end; pos++) {
#define LLDB_LOGF(log,...)
A uniqued constant string class.
uint16_t FormatCategoryItems
bool Delete(KeyType name)
std::function< bool(const lldb::TypeCategoryImplSP &)> ForEachCallback
static const Position Last
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
void DisableAllCategories()
void EnableAllCategories()
bool Get(KeyType name, lldb::TypeCategoryImplSP &entry)
static const Position First
void ForEach(ForEachCallback callback)
TypeCategoryMap(IFormatChangeListener *lst)
lldb::LanguageType GetObjectRuntimeLanguage()
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::TypeSummaryImpl > TypeSummaryImplSP
std::shared_ptr< lldb_private::TypeFormatImpl > TypeFormatImplSP
std::shared_ptr< lldb_private::SyntheticChildren > SyntheticChildrenSP
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP