1 //===- IPDBEnumChildren.h - base interface for child enumerator -*- 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 LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
10 #define LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
19 template <typename ChildType> class IPDBEnumChildren {
21 using ChildTypePtr = std::unique_ptr<ChildType>;
22 using MyType = IPDBEnumChildren<ChildType>;
24 virtual ~IPDBEnumChildren() = default;
26 virtual uint32_t getChildCount() const = 0;
27 virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
28 virtual ChildTypePtr getNext() = 0;
29 virtual void reset() = 0;
32 template <typename ChildType>
33 class NullEnumerator : public IPDBEnumChildren<ChildType> {
34 virtual uint32_t getChildCount() const override { return 0; }
35 virtual std::unique_ptr<ChildType>
36 getChildAtIndex(uint32_t Index) const override {
39 virtual std::unique_ptr<ChildType> getNext() override {
42 virtual void reset() override {}
45 } // end namespace pdb
46 } // end namespace llvm
48 #endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H