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 17 namespace lldb_private { 18 19 class VariableList 20 { 21 public: 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 uint32_t 54 FindVariableIndex (const lldb::VariableSP &var_sp); 55 56 // Returns the actual number of unique variables that were added to the 57 // list. "total_matches" will get updated with the actualy number of 58 // matches that were found regardless of whether they were unique or not 59 // to allow for error conditions when nothing is found, versus conditions 60 // where any varaibles that match "regex" were already in "var_list". 61 size_t 62 AppendVariablesIfUnique (const RegularExpression& regex, 63 VariableList &var_list, 64 size_t& total_matches); 65 66 size_t 67 AppendVariablesWithScope (lldb::ValueType type, 68 VariableList &var_list, 69 bool if_unique = true); 70 71 uint32_t 72 FindIndexForVariable (Variable* variable); 73 74 size_t 75 MemorySize() const; 76 77 size_t 78 GetSize() const; 79 80 protected: 81 typedef std::vector<lldb::VariableSP> collection; 82 typedef collection::iterator iterator; 83 typedef collection::const_iterator const_iterator; 84 85 collection m_variables; 86 private: 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