Go to the documentation of this file.
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"
108 virtual llvm::raw_ostream &dump(llvm::raw_ostream &
OS)
const = 0;
120 std::vector<std::pair<DocID, float>>
consume(Iterator &It);
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;
186 template <
typename... Args>
187 std::unique_ptr<Iterator>
unionOf(Args... args)
const {
188 std::vector<std::unique_ptr<Iterator>>
Children;
198 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_ITERATOR_H
virtual size_t estimateSize() const =0
Returns an estimate of advance() calls before the iterator is exhausted.
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...
std::unique_ptr< Iterator > boost(std::unique_ptr< Iterator > Child, float Factor) const
Returns BOOST iterator which multiplies the score of each item by given factor.
std::vector< std::pair< DocID, float > > consume(Iterator &It)
Advances the iterator until it is exhausted.
std::unique_ptr< Iterator > all() const
Returns TRUE Iterator which iterates over "virtual" PostingList containing all items in range [0,...
virtual void advanceTo(DocID ID)=0
Moves to the first valid DocID which is equal or higher than given ID.
std::unique_ptr< Iterator > intersect(std::vector< std::unique_ptr< Iterator >> Children) const
Returns AND Iterator which performs the intersection of the PostingLists of its children.
std::unique_ptr< Iterator > none() const
Returns FALSE Iterator which iterates over no documents.
std::vector< std::unique_ptr< HTMLNode > > Children
virtual void advance()=0
Moves to next valid DocID.
void populateChildren(std::vector< std::unique_ptr< Iterator >> &)
std::unique_ptr< Iterator > unionOf(Args... args) const
This allows unionOf(create(...), create(...)) syntax.
Kind
Inspect iterator type, used internally for optimizing query trees.
virtual DocID peek() const =0
Returns the current element this iterator points to.
Iterator is the interface for Query Tree node.
virtual bool reachedEnd() const =0
Returns true if all valid DocIDs were processed and hence the iterator is exhausted.
Iterator(Kind MyKind=Kind::Other)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::raw_string_ostream OS
uint32_t DocID
Symbol position in the list of all index symbols sorted by a pre-computed symbol quality.
std::unique_ptr< Iterator > limit(std::unique_ptr< Iterator > Child, size_t Limit) const
Returns LIMIT iterator, which yields up to N elements of its child iterator.
virtual float consume()=0
Informs the iterator that the current document was consumed, and returns its boost.
std::unique_ptr< Iterator > unionOf(std::vector< std::unique_ptr< Iterator >> Children) const
Returns OR Iterator which performs the union of the PostingLists of its children.
std::unique_ptr< Iterator > intersect(Args... args) const
This allows intersect(create(...), create(...)) syntax.