xref: /freebsd/contrib/llvm-project/lldb/include/lldb/DataFormatters/VectorIterator.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===-- VectorIterator.h ----------------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_DATAFORMATTERS_VECTORITERATOR_H
11 #define LLDB_DATAFORMATTERS_VECTORITERATOR_H
12 
13 #include "lldb/lldb-forward.h"
14 
15 #include "lldb/DataFormatters/TypeSynthetic.h"
16 #include "lldb/Target/ExecutionContext.h"
17 #include "lldb/Utility/ConstString.h"
18 #include "llvm/ADT/SmallVector.h"
19 
20 namespace lldb_private {
21 namespace formatters {
22 class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
23 public:
24   VectorIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp,
25                                   llvm::ArrayRef<ConstString> item_names);
26 
27   llvm::Expected<uint32_t> CalculateNumChildren() override;
28 
29   lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override;
30 
31   lldb::ChildCacheState Update() override;
32 
33   bool MightHaveChildren() override;
34 
35   size_t GetIndexOfChildWithName(ConstString name) override;
36 
37 private:
38   ExecutionContextRef m_exe_ctx_ref;
39   llvm::SmallVector<ConstString, 2> m_item_names;
40   lldb::ValueObjectSP m_item_sp;
41 };
42 
43 } // namespace formatters
44 } // namespace lldb_private
45 
46 #endif // LLDB_DATAFORMATTERS_VECTORITERATOR_H
47