32 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H 33 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H 35 #include "llvm/ADT/ArrayRef.h" 36 #include "llvm/Support/raw_ostream.h" 96 friend llvm::raw_ostream &
operator<<(llvm::raw_ostream &OS,
98 return Iterator.dump(OS);
109 virtual llvm::raw_ostream &dump(llvm::raw_ostream &OS)
const = 0;
126 template <
typename... TailT>
128 std::unique_ptr<Iterator>
Head, TailT...
Tail) {
129 Children.push_back(move(Head));
146 std::unique_ptr<Iterator>
147 intersect(std::vector<std::unique_ptr<Iterator>> Children)
const;
154 std::unique_ptr<Iterator>
155 unionOf(std::vector<std::unique_ptr<Iterator>> Children)
const;
159 std::unique_ptr<Iterator> all()
const;
162 std::unique_ptr<Iterator> none()
const;
168 std::unique_ptr<Iterator> boost(std::unique_ptr<Iterator> Child,
175 std::unique_ptr<Iterator> limit(std::unique_ptr<Iterator> Child,
179 template <
typename... Args>
180 std::unique_ptr<Iterator>
intersect(Args... args)
const {
181 std::vector<std::unique_ptr<Iterator>> Children;
183 return intersect(move(Children));
187 template <
typename... Args>
188 std::unique_ptr<Iterator>
unionOf(Args... args)
const {
189 std::vector<std::unique_ptr<Iterator>> Children;
191 return unionOf(move(Children));
199 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H
virtual float consume()=0
Informs the iterator that the current document was consumed, and returns its boost.
Iterator is the interface for Query Tree node.
virtual DocID peek() const =0
Returns the current element this iterator points to.
Kind
Inspect iterator type, used internally for optimizing query trees.
virtual size_t estimateSize() const =0
Returns an estimate of advance() calls before the iterator is exhausted.
uint32_t DocID
Symbol position in the list of all index symbols sorted by a pre-computed symbol quality.
virtual void advance()=0
Moves to next valid DocID.
void populateChildren(std::vector< std::unique_ptr< Iterator >> &)
Iterator(Kind MyKind=Kind::Other)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
virtual void advanceTo(DocID ID)=0
Moves to the first valid DocID which is equal or higher than given ID.
virtual bool reachedEnd() const =0
Returns true if all valid DocIDs were processed and hence the iterator is exhausted.
void populateChildren(std::vector< std::unique_ptr< Iterator >> &Children, std::unique_ptr< Iterator > Head, TailT... Tail)
std::unique_ptr< Iterator > intersect(Args... args) const
This allows intersect(create(...), create(...)) syntax.
std::unique_ptr< Iterator > unionOf(Args... args) const
This allows unionOf(create(...), create(...)) syntax.
friend llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Iterator &Iterator)
Prints a convenient human-readable iterator representation by recursively dumping iterators in the fo...