31 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H 32 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H 34 #include "llvm/ADT/ArrayRef.h" 35 #include "llvm/Support/raw_ostream.h" 95 friend llvm::raw_ostream &
operator<<(llvm::raw_ostream &OS,
97 return Iterator.dump(OS);
108 virtual llvm::raw_ostream &dump(llvm::raw_ostream &OS)
const = 0;
125 template <
typename... TailT>
127 std::unique_ptr<Iterator>
Head, TailT...
Tail) {
145 std::unique_ptr<Iterator>
146 intersect(std::vector<std::unique_ptr<Iterator>>
Children)
const;
153 std::unique_ptr<Iterator>
154 unionOf(std::vector<std::unique_ptr<Iterator>>
Children)
const;
158 std::unique_ptr<Iterator> all()
const;
161 std::unique_ptr<Iterator> none()
const;
167 std::unique_ptr<Iterator> boost(std::unique_ptr<Iterator> Child,
174 std::unique_ptr<Iterator> limit(std::unique_ptr<Iterator> Child,
178 template <
typename... Args>
179 std::unique_ptr<Iterator>
intersect(Args... args)
const {
180 std::vector<std::unique_ptr<Iterator>>
Children;
182 return intersect(move(Children));
186 template <
typename... Args>
187 std::unique_ptr<Iterator>
unionOf(Args... args)
const {
188 std::vector<std::unique_ptr<Iterator>>
Children;
190 return unionOf(move(Children));
198 #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 >> &)
std::vector< std::unique_ptr< HTMLNode > > Children
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...