1 //===-- VariableList.h ------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_VariableList_h_
10 #define liblldb_VariableList_h_
12 #include "lldb/Symbol/SymbolContext.h"
13 #include "lldb/Symbol/Variable.h"
14 #include "lldb/lldb-private.h"
16 namespace lldb_private {
20 // Constructors and Destructors
21 // VariableList(const SymbolContext &symbol_context);
23 virtual ~VariableList();
25 void AddVariable(const lldb::VariableSP &var_sp);
27 bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
29 void AddVariables(VariableList *variable_list);
33 void Dump(Stream *s, bool show_context) const;
35 lldb::VariableSP GetVariableAtIndex(size_t idx) const;
37 lldb::VariableSP RemoveVariableAtIndex(size_t idx);
39 lldb::VariableSP FindVariable(ConstString name,
40 bool include_static_members = true);
42 lldb::VariableSP FindVariable(ConstString name,
43 lldb::ValueType value_type,
44 bool include_static_members = true);
46 uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
48 size_t AppendVariablesIfUnique(VariableList &var_list);
50 // Returns the actual number of unique variables that were added to the list.
51 // "total_matches" will get updated with the actually number of matches that
52 // were found regardless of whether they were unique or not to allow for
53 // error conditions when nothing is found, versus conditions where any
54 // variables that match "regex" were already in "var_list".
55 size_t AppendVariablesIfUnique(const RegularExpression ®ex,
56 VariableList &var_list, size_t &total_matches);
58 size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list,
59 bool if_unique = true);
61 uint32_t FindIndexForVariable(Variable *variable);
63 size_t MemorySize() const;
65 size_t GetSize() const;
66 bool Empty() const { return m_variables.empty(); }
69 typedef std::vector<lldb::VariableSP> collection;
70 typedef collection::iterator iterator;
71 typedef collection::const_iterator const_iterator;
73 collection m_variables;
76 // For VariableList only
77 DISALLOW_COPY_AND_ASSIGN(VariableList);
80 } // namespace lldb_private
82 #endif // liblldb_VariableList_h_