LLDB  mainline
VariableList.h
Go to the documentation of this file.
1 //===-- VariableList.h ------------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_VariableList_h_
10 #define liblldb_VariableList_h_
11 
13 #include "lldb/Symbol/Variable.h"
14 #include "lldb/lldb-private.h"
15 
16 namespace lldb_private {
17 
18 class VariableList {
19 public:
20  // Constructors and Destructors
21  // VariableList(const SymbolContext &symbol_context);
22  VariableList();
23  virtual ~VariableList();
24 
25  void AddVariable(const lldb::VariableSP &var_sp);
26 
27  bool AddVariableIfUnique(const lldb::VariableSP &var_sp);
28 
29  void AddVariables(VariableList *variable_list);
30 
31  void Clear();
32 
33  void Dump(Stream *s, bool show_context) const;
34 
35  lldb::VariableSP GetVariableAtIndex(size_t idx) const;
36 
37  lldb::VariableSP RemoveVariableAtIndex(size_t idx);
38 
39  lldb::VariableSP FindVariable(ConstString name,
40  bool include_static_members = true);
41 
42  lldb::VariableSP FindVariable(ConstString name,
43  lldb::ValueType value_type,
44  bool include_static_members = true);
45 
46  uint32_t FindVariableIndex(const lldb::VariableSP &var_sp);
47 
48  size_t AppendVariablesIfUnique(VariableList &var_list);
49 
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 &regex,
56  VariableList &var_list, size_t &total_matches);
57 
59  bool if_unique = true);
60 
62 
63  size_t MemorySize() const;
64 
65  size_t GetSize() const;
66  bool Empty() const { return m_variables.empty(); }
67 
68 protected:
69  typedef std::vector<lldb::VariableSP> collection;
70  typedef collection::iterator iterator;
71  typedef collection::const_iterator const_iterator;
72 
73  collection m_variables;
74 
75 private:
76  // For VariableList only
77  DISALLOW_COPY_AND_ASSIGN(VariableList);
78 };
79 
80 } // namespace lldb_private
81 
82 #endif // liblldb_VariableList_h_
size_t AppendVariablesWithScope(lldb::ValueType type, VariableList &var_list, bool if_unique=true)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
void AddVariables(VariableList *variable_list)
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
void AddVariable(const lldb::VariableSP &var_sp)
"lldb/Utility/RegularExpression.h" A C++ wrapper class for regex.
collection::iterator iterator
Definition: VariableList.h:70
collection::const_iterator const_iterator
Definition: VariableList.h:71
void Dump(Stream *s, bool show_context) const
lldb::VariableSP GetVariableAtIndex(size_t idx) const
lldb::VariableSP FindVariable(ConstString name, bool include_static_members=true)
uint32_t FindVariableIndex(const lldb::VariableSP &var_sp)
size_t AppendVariablesIfUnique(VariableList &var_list)
std::vector< lldb::VariableSP > collection
Definition: VariableList.h:69
uint32_t FindIndexForVariable(Variable *variable)
A uniqued constant string class.
Definition: ConstString.h:38
bool AddVariableIfUnique(const lldb::VariableSP &var_sp)
lldb::VariableSP RemoveVariableAtIndex(size_t idx)