19 : m_map_mutex(), listener(lst), m_map(), m_active_categories() {
23 Add(default_cs, default_sp);
29 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
42 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
44 if (iter ==
m_map.end())
59 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
61 if (!
Get(category_name, category))
63 return Enable(category, pos);
67 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
69 if (!
Get(category_name, category))
75 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
90 category->Enable(
true, pos);
97 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
107 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
109 MapType::iterator iter =
m_map.begin(), end =
m_map.end();
110 for (; iter != end; ++iter) {
111 if (iter->second->IsEnabled())
113 auto pos = iter->second->GetLastEnabledPosition();
114 if (pos >= sorted_categories.size()) {
115 auto iter = std::find_if(
116 sorted_categories.begin(), sorted_categories.end(),
118 pos = std::distance(sorted_categories.begin(), iter);
120 sorted_categories.at(pos) = iter->second;
122 decltype(sorted_categories)::iterator viter = sorted_categories.begin(),
123 vend = sorted_categories.end();
124 for (; viter != vend; viter++)
130 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
139 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
152 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
154 if (iter ==
m_map.end())
156 entry = iter->second;
163 const char **matching_category,
165 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
168 for (pos =
m_map.begin(); pos != end; pos++) {
169 if (pos->second->AnyMatches(candidate_type, items, only_enabled,
170 matching_category, matching_type))
176template <
typename ImplSP>
178 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
188 "[%s] candidate match = %s %s %s %s",
190 match.GetTypeName().GetCString(),
191 match.DidStripPointer() ?
"strip-pointers" :
"no-strip-pointers",
192 match.DidStripReference() ?
"strip-reference" :
"no-strip-reference",
193 match.DidStripTypedef() ?
"strip-typedef" :
"no-strip-typedef");
199 ImplSP current_format;
200 LLDB_LOGF(log,
"[%s] Trying to use category %s", __FUNCTION__,
201 category_sp->GetName());
202 if (!category_sp->Get(
207 retval = std::move(current_format);
210 LLDB_LOGF(log,
"[%s] nothing found - returning empty SP", __FUNCTION__);
221template void TypeCategoryMap::Get<lldb::SyntheticChildrenSP>(
227 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
234 if (!callback(category))
242 for (pos =
m_map.begin(); pos != end; pos++) {
243 if (pos->second->IsEnabled())
245 if (!callback(pos->second))
253 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
255 if (index <
m_map.size()) {
257 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