VariableList.h revision b3a1a2bba41281ba56a99fe64887a8a04760784c
1//===-- VariableList.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_VariableList_h_ 11#define liblldb_VariableList_h_ 12 13#include "lldb/lldb-private.h" 14#include "lldb/Symbol/SymbolContext.h" 15#include "lldb/Symbol/Variable.h" 16 17namespace lldb_private { 18 19class VariableList 20{ 21public: 22 //------------------------------------------------------------------ 23 // Constructors and Destructors 24 //------------------------------------------------------------------ 25// VariableList(const SymbolContext &symbol_context); 26 VariableList(); 27 virtual ~VariableList(); 28 29 void 30 AddVariable (const lldb::VariableSP &var_sp); 31 32 bool 33 AddVariableIfUnique (const lldb::VariableSP &var_sp); 34 35 void 36 AddVariables (VariableList *variable_list); 37 38 void 39 Clear(); 40 41 void 42 Dump(Stream *s, bool show_context) const; 43 44 lldb::VariableSP 45 GetVariableAtIndex(uint32_t idx); 46 47 lldb::VariableSP 48 RemoveVariableAtIndex (uint32_t idx); 49 50 lldb::VariableSP 51 FindVariable (const ConstString& name); 52 53 // Find the argument variable that represents the language specific 54 // object pointer ("this" in C++, or "self" in Objective C). 55 lldb::VariableSP 56 FindArtificialObjectVariable (lldb::LanguageType language) const; 57 58 uint32_t 59 FindVariableIndex (const lldb::VariableSP &var_sp); 60 61 // Returns the actual number of unique variables that were added to the 62 // list. "total_matches" will get updated with the actualy number of 63 // matches that were found regardless of whether they were unique or not 64 // to allow for error conditions when nothing is found, versus conditions 65 // where any varaibles that match "regex" were already in "var_list". 66 size_t 67 AppendVariablesIfUnique (const RegularExpression& regex, 68 VariableList &var_list, 69 size_t& total_matches); 70 71 uint32_t 72 FindIndexForVariable (Variable* variable); 73 74 size_t 75 MemorySize() const; 76 77 size_t 78 GetSize() const; 79 80protected: 81 typedef std::vector<lldb::VariableSP> collection; 82 typedef collection::iterator iterator; 83 typedef collection::const_iterator const_iterator; 84 85 collection m_variables; 86private: 87 //------------------------------------------------------------------ 88 // For VariableList only 89 //------------------------------------------------------------------ 90 DISALLOW_COPY_AND_ASSIGN (VariableList); 91}; 92 93} // namespace lldb_private 94 95#endif // liblldb_VariableList_h_ 96