1254721Semaste//===-- TypeList.h ----------------------------------------------*- C++ -*-===//
2254721Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6254721Semaste//
7254721Semaste//===----------------------------------------------------------------------===//
8254721Semaste
9254721Semaste#ifndef liblldb_TypeList_h_
10254721Semaste#define liblldb_TypeList_h_
11254721Semaste
12254721Semaste#include "lldb/Symbol/Type.h"
13258884Semaste#include "lldb/Utility/Iterable.h"
14314564Sdim#include "lldb/lldb-private.h"
15314564Sdim#include <functional>
16296417Sdim#include <vector>
17254721Semaste
18254721Semastenamespace lldb_private {
19254721Semaste
20314564Sdimclass TypeList {
21254721Semastepublic:
22314564Sdim  // Constructors and Destructors
23314564Sdim  TypeList();
24254721Semaste
25314564Sdim  virtual ~TypeList();
26254721Semaste
27314564Sdim  void Clear();
28254721Semaste
29314564Sdim  void Dump(Stream *s, bool show_context);
30254721Semaste
31353358Sdim  TypeList FindTypes(ConstString name);
32254721Semaste
33314564Sdim  void Insert(const lldb::TypeSP &type);
34254721Semaste
35314564Sdim  uint32_t GetSize() const;
36254721Semaste
37360784Sdim  bool Empty() const { return !GetSize(); }
38360784Sdim
39314564Sdim  lldb::TypeSP GetTypeAtIndex(uint32_t idx);
40254721Semaste
41314564Sdim  typedef std::vector<lldb::TypeSP> collection;
42314564Sdim  typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter>
43314564Sdim      TypeIterable;
44254721Semaste
45314564Sdim  TypeIterable Types() { return TypeIterable(m_types); }
46254721Semaste
47314564Sdim  void ForEach(
48314564Sdim      std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
49254721Semaste
50314564Sdim  void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
51254721Semaste
52314564Sdim  void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
53254721Semaste
54314564Sdim  void RemoveMismatchedTypes(const std::string &type_scope,
55314564Sdim                             const std::string &type_basename,
56314564Sdim                             lldb::TypeClass type_class, bool exact_match);
57254721Semaste
58314564Sdim  void RemoveMismatchedTypes(lldb::TypeClass type_class);
59314564Sdim
60254721Semasteprivate:
61314564Sdim  typedef collection::iterator iterator;
62314564Sdim  typedef collection::const_iterator const_iterator;
63254721Semaste
64314564Sdim  collection m_types;
65254721Semaste
66314564Sdim  DISALLOW_COPY_AND_ASSIGN(TypeList);
67254721Semaste};
68254721Semaste
69254721Semaste} // namespace lldb_private
70254721Semaste
71314564Sdim#endif // liblldb_TypeList_h_
72