9#ifndef LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
10#define LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
70 while (type_lexer.
NextIf({
' ',
'\t',
'\v',
'\f'}).first)
99 return m_name == type_name ||
112 std::make_shared<TypeImpl>(candidate_type.
GetType()));
143 typedef typename std::shared_ptr<ValueType>
ValueSP;
144 typedef std::vector<std::pair<TypeMatcher, ValueSP>>
MapType;
147 typedef typename std::shared_ptr<FormattersContainer<ValueType>>
156 entry->GetRevision() =
listener->GetCurrentRevision();
158 entry->GetRevision() = 0;
160 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
162 m_map.emplace_back(std::move(matcher), std::move(entry));
168 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
169 for (
auto iter =
m_map.begin(); iter !=
m_map.end(); ++iter)
170 if (iter->first.CreatedBySameMatchString(matcher)) {
181 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
182 for (
auto &formatter : llvm::reverse(
m_map)) {
183 if (formatter.first.Matches(candidate)) {
184 entry = formatter.second;
195 if (
Get(candidate, entry)) {
196 if (candidate.IsMatch(entry))
206 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
207 for (
const auto &pos :
m_map)
208 if (pos.first.CreatedBySameMatchString(matcher)) {
216 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
217 if (index >=
m_map.size())
219 return m_map[index].second;
223 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
224 if (index >=
m_map.size())
227 return std::make_shared<TypeNameSpecifierImpl>(
233 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
241 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
242 for (
const auto &pos :
m_map) {
244 if (!callback(type, pos.second))
251 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
static llvm::StringRef GetName(XcodeSDK::Type type)
"lldb/Utility/ArgCompletionRequest.h"
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
virtual bool FormatterCallbackFunction(const char *function_name, lldb::TypeImplSP type_impl_sp)
bool AdvanceIf(const std::string &token)
Class for matching type names.
ConstString GetMatchString() const
Returns the underlying match string for this TypeMatcher.
TypeMatcher(lldb::TypeNameSpecifierImplSP type_specifier)
Creates a matcher using the matching type and string from the given type name specifier.
TypeMatcher(ConstString type_name)
Creates a matcher that accepts any type with exactly the given type name.
lldb::FormatterMatchType m_match_type
Indicates what kind of matching strategy should be used:
RegularExpression m_type_name_regex
lldb::FormatterMatchType GetMatchType() const
static ConstString StripTypeName(ConstString type)
bool CreatedBySameMatchString(TypeMatcher other) const
Returns true if this TypeMatcher and the given one were most created by the same match string.
TypeMatcher(RegularExpression regex)
Creates a matcher that accepts any type matching the given regex.
ConstString m_name
Type name for exact match, or name of the python callback if m_match_type is eFormatterMatchCallback.
bool Matches(FormattersMatchCandidate candidate_type) const
True iff this matches the given type.
A class that represents a running process on the host machine.
std::vector< FormattersMatchCandidate > FormattersMatchVector
std::shared_ptr< lldb_private::TypeNameSpecifierImpl > TypeNameSpecifierImplSP
FormatterMatchType
Type of match to be performed when looking for a formatter for a data type.
@ eFormatterMatchCallback