TypeMap.h revision 296417
1//===-- TypeMap.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_TypeMap_h_ 11#define liblldb_TypeMap_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 TypeMap 22{ 23public: 24 //------------------------------------------------------------------ 25 // Constructors and Destructors 26 //------------------------------------------------------------------ 27 TypeMap(); 28 29 virtual 30 ~TypeMap(); 31 32 void 33 Clear(); 34 35 void 36 Dump(Stream *s, bool show_context); 37 38 TypeMap 39 FindTypes(const ConstString &name); 40 41 void 42 Insert (const lldb::TypeSP& type); 43 44 bool 45 Empty() const; 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 Remove (const lldb::TypeSP &type_sp); 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 (TypeMap); 94}; 95 96} // namespace lldb_private 97 98#endif // liblldb_TypeMap_h_ 99