9#ifndef LLDB_CORE_UNIQUECSTRINGMAP_H
10#define LLDB_CORE_UNIQUECSTRINGMAP_H
36 typedef typename collection::iterator
iterator;
55 if (idx <
m_map.size()) {
56 value =
m_map[idx].value;
63 return m_map[idx].cstring;
73 return m_map[idx].value;
87 auto pos = llvm::lower_bound(
m_map, unique_cstr,
Compare());
88 if (pos !=
m_map.end() && pos->cstring == unique_cstr)
99 auto pos = llvm::lower_bound(
m_map, unique_cstr,
Compare());
100 if (pos !=
m_map.end() && pos->cstring == unique_cstr)
112 if (!
m_map.empty()) {
114 const Entry *after_last_entry = first_entry +
m_map.size();
115 const Entry *next_entry = entry_ptr + 1;
116 if (first_entry <= next_entry && next_entry < after_last_entry) {
125 const size_t start_size = values.size();
127 for (
const Entry &entry : llvm::make_range(std::equal_range(
129 values.push_back(entry.value);
131 return values.size() - start_size;
135 std::vector<T> &values)
const {
136 const size_t start_size = values.size();
139 for (pos =
m_map.begin(); pos !=
end; ++pos) {
140 if (regex.
Execute(pos->cstring.GetCString()))
141 values.push_back(pos->value);
144 return values.size() - start_size;
169 Sort([](
const T &,
const T &) {
return false; });
174 template <
typename TCompare>
void Sort(TCompare tc) {
202 llvm::iterator_range<const_iterator>
204 return llvm::make_range(
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
ConstString GetCStringAtIndexUnchecked(uint32_t idx) const
llvm::iterator_range< const_iterator > equal_range(ConstString unique_cstr) const
size_t GetValues(ConstString unique_cstr, std::vector< T > &values) const
const T & GetValueRefAtIndexUnchecked(uint32_t idx) const
ConstString GetCStringAtIndex(uint32_t idx) const
const Entry * FindFirstValueForName(ConstString unique_cstr) const
bool GetValueAtIndex(uint32_t idx, T &value) const
T GetValueAtIndexUnchecked(uint32_t idx) const
void Sort(TCompare tc)
Sort contents of this map using the provided comparator to break ties for entries with the same strin...
T Find(ConstString unique_cstr, T fail_value) const
const_iterator end() const
const Entry * FindNextValueForName(const Entry *entry_ptr) const
std::vector< Entry > collection
collection::const_iterator const_iterator
const_iterator begin() const
void Append(const Entry &e)
size_t GetValues(const RegularExpression ®ex, std::vector< T > &values) const
collection::iterator iterator
void Append(ConstString unique_cstr, const T &value)
A class that represents a running process on the host machine.
bool operator()(ConstString lhs, const Entry &rhs)
bool operator()(const Entry &lhs, ConstString rhs)
bool operator()(ConstString lhs, ConstString rhs)
int ThreeWay(ConstString lhs, ConstString rhs)
bool operator()(const Entry &lhs, const Entry &rhs)
Entry(ConstString cstr, const T &v)