TypeList.h revision 263367
1//===-- TypeList.h ----------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_TypeList_h_
11#define liblldb_TypeList_h_
12
13#include "lldb/lldb-private.h"
14#include "lldb/Symbol/Type.h"
15#include "lldb/Utility/Iterable.h"
16#include <map>
17#include <functional>
18
19namespace lldb_private {
20
21class TypeList
22{
23public:
24    //------------------------------------------------------------------
25    // Constructors and Destructors
26    //------------------------------------------------------------------
27    TypeList();
28
29    virtual
30    ~TypeList();
31
32    void
33    Clear();
34
35    void
36    Dump(Stream *s, bool show_context);
37
38//    lldb::TypeSP
39//    FindType(lldb::user_id_t uid);
40
41    TypeList
42    FindTypes(const ConstString &name);
43
44    void
45    Insert (const lldb::TypeSP& type);
46
47    bool
48    InsertUnique (const lldb::TypeSP& type);
49
50    uint32_t
51    GetSize() const;
52
53    lldb::TypeSP
54    GetTypeAtIndex(uint32_t idx);
55
56    typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
57    typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
58
59    TypeIterable
60    Types ()
61    {
62        return TypeIterable(m_types);
63    }
64
65    void
66    ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &callback) const;
67
68    void
69    ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback);
70
71    bool
72    RemoveTypeWithUID (lldb::user_id_t uid);
73
74    void
75    RemoveMismatchedTypes (const char *qualified_typename,
76                           bool exact_match);
77
78    void
79    RemoveMismatchedTypes (const std::string &type_scope,
80                           const std::string &type_basename,
81                           lldb::TypeClass type_class,
82                           bool exact_match);
83
84    void
85    RemoveMismatchedTypes (lldb::TypeClass type_class);
86
87private:
88    typedef collection::iterator iterator;
89    typedef collection::const_iterator const_iterator;
90
91    collection m_types;
92
93    DISALLOW_COPY_AND_ASSIGN (TypeList);
94};
95
96} // namespace lldb_private
97
98#endif  // liblldb_TypeList_h_
99