1 //===-- VariableList.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_VariableList_h_
11 #define liblldb_VariableList_h_
13 #include "lldb/Symbol/SymbolContext.h"
14 #include "lldb/Symbol/Variable.h"
15 #include "lldb/lldb-private.h"
17 namespace lldb_private {
21 //------------------------------------------------------------------
22 // Constructors and Destructors
23 //------------------------------------------------------------------
24 // VariableList(const SymbolContext &symbol_context);
26 virtual ~VariableList();
28 void AddVariable(const lldb::VariableSP &var_sp);
30 bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
32 void AddVariables(VariableList *variable_list);
36 void Dump(Stream *s, bool show_context) const;
38 lldb::VariableSP GetVariableAtIndex(size_t idx) const;
40 lldb::VariableSP RemoveVariableAtIndex(size_t idx);
42 lldb::VariableSP FindVariable(const ConstString &name,
43 bool include_static_members = true);
45 lldb::VariableSP FindVariable(const ConstString &name,
46 lldb::ValueType value_type,
47 bool include_static_members = true);
49 uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
51 size_t AppendVariablesIfUnique(VariableList &var_list);
53 // Returns the actual number of unique variables that were added to the
54 // list. "total_matches" will get updated with the actually number of
55 // matches that were found regardless of whether they were unique or not
56 // to allow for error conditions when nothing is found, versus conditions
57 // where any variables that match "regex" were already in "var_list".
58 size_t AppendVariablesIfUnique(const RegularExpression ®ex,
59 VariableList &var_list, size_t &total_matches);
61 size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list,
62 bool if_unique = true);
64 uint32_t FindIndexForVariable(Variable *variable);
66 size_t MemorySize() const;
68 size_t GetSize() const;
71 typedef std::vector<lldb::VariableSP> collection;
72 typedef collection::iterator iterator;
73 typedef collection::const_iterator const_iterator;
75 collection m_variables;
78 //------------------------------------------------------------------
79 // For VariableList only
80 //------------------------------------------------------------------
81 DISALLOW_COPY_AND_ASSIGN(VariableList);
84 } // namespace lldb_private
86 #endif // liblldb_VariableList_h_