1//===-- TypeList.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 liblldb_TypeList_h_
10#define liblldb_TypeList_h_
11
12#include "lldb/Symbol/Type.h"
13#include "lldb/Utility/Iterable.h"
14#include "lldb/lldb-private.h"
15#include <functional>
16#include <vector>
17
18namespace lldb_private {
19
20class TypeList {
21public:
22  // Constructors and Destructors
23  TypeList();
24
25  virtual ~TypeList();
26
27  void Clear();
28
29  void Dump(Stream *s, bool show_context);
30
31  TypeList FindTypes(ConstString name);
32
33  void Insert(const lldb::TypeSP &type);
34
35  uint32_t GetSize() const;
36
37  bool Empty() const { return !GetSize(); }
38
39  lldb::TypeSP GetTypeAtIndex(uint32_t idx);
40
41  typedef std::vector<lldb::TypeSP> collection;
42  typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter>
43      TypeIterable;
44
45  TypeIterable Types() { return TypeIterable(m_types); }
46
47  void ForEach(
48      std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
49
50  void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
51
52  void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
53
54  void RemoveMismatchedTypes(const std::string &type_scope,
55                             const std::string &type_basename,
56                             lldb::TypeClass type_class, bool exact_match);
57
58  void RemoveMismatchedTypes(lldb::TypeClass type_class);
59
60private:
61  typedef collection::iterator iterator;
62  typedef collection::const_iterator const_iterator;
63
64  collection m_types;
65
66  DISALLOW_COPY_AND_ASSIGN(TypeList);
67};
68
69} // namespace lldb_private
70
71#endif // liblldb_TypeList_h_
72