VariableList.h revision 262528
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(size_t idx) const; 46 47 lldb::VariableSP 48 RemoveVariableAtIndex (size_t idx); 49 50 lldb::VariableSP 51 FindVariable (const ConstString& name); 52 53 lldb::VariableSP 54 FindVariable (const ConstString& name, lldb::ValueType value_type); 55 56 uint32_t 57 FindVariableIndex (const lldb::VariableSP &var_sp); 58 59 size_t 60 AppendVariablesIfUnique(VariableList &var_list); 61 62 // Returns the actual number of unique variables that were added to the 63 // list. "total_matches" will get updated with the actualy number of 64 // matches that were found regardless of whether they were unique or not 65 // to allow for error conditions when nothing is found, versus conditions 66 // where any varaibles that match "regex" were already in "var_list". 67 size_t 68 AppendVariablesIfUnique (const RegularExpression& regex, 69 VariableList &var_list, 70 size_t& total_matches); 71 72 size_t 73 AppendVariablesWithScope (lldb::ValueType type, 74 VariableList &var_list, 75 bool if_unique = true); 76 77 uint32_t 78 FindIndexForVariable (Variable* variable); 79 80 size_t 81 MemorySize() const; 82 83 size_t 84 GetSize() const; 85 86protected: 87 typedef std::vector<lldb::VariableSP> collection; 88 typedef collection::iterator iterator; 89 typedef collection::const_iterator const_iterator; 90 91 collection m_variables; 92private: 93 //------------------------------------------------------------------ 94 // For VariableList only 95 //------------------------------------------------------------------ 96 DISALLOW_COPY_AND_ASSIGN (VariableList); 97}; 98 99} // namespace lldb_private 100 101#endif // liblldb_VariableList_h_ 102