/usr/include/CLucene/index/Terms.h is in libclucene-dev 0.9.21b-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | /*------------------------------------------------------------------------------
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
*
* Distributable under the terms of either the Apache License (Version 2.0) or
* the GNU Lesser General Public License, as specified in the COPYING file.
------------------------------------------------------------------------------*/
#ifndef _lucene_index_Terms_
#define _lucene_index_Terms_
#if defined(_LUCENE_PRAGMA_ONCE)
# pragma once
#endif
#include "Term.h"
CL_NS_DEF(index)
class TermEnum; //predefine
class TermPositions;
/** TermDocs provides an interface for enumerating <document, frequency>
pairs for a term. <p> The document portion names each document containing
the term. Documents are indicated by number. The frequency portion gives
the number of times the term occurred in each document. <p> The pairs are
ordered by document number.
@see IndexReader#termDocs()
*/
class TermDocs: LUCENE_BASE {
public:
virtual ~TermDocs(){
}
// Sets this to the data for a term.
// The enumeration is reset to the start of the data for this term.
virtual void seek(Term* term)=0;
/** Sets this to the data for the current term in a {@link TermEnum}.
* This may be optimized in some implementations.
*/
virtual void seek(TermEnum* termEnum)=0;
// Returns the current document number. <p> This is invalid until {@link
// #next()} is called for the first time.
virtual int32_t doc() const=0;
// Returns the frequency of the term within the current document. <p> This
// is invalid until {@link #next()} is called for the first time.
virtual int32_t freq() const=0;
// Moves to the next pair in the enumeration. <p> Returns true iff there is
// such a next pair in the enumeration.
virtual bool next() =0;
// Attempts to read multiple entries from the enumeration, up to length of
// <i>docs</i>. Document numbers are stored in <i>docs</i>, and term
// frequencies are stored in <i>freqs</i>. The <i>freqs</i> array must be as
// int64_t as the <i>docs</i> array.
//
// <p>Returns the number of entries read. Zero is only returned when the
// stream has been exhausted.
virtual int32_t read(int32_t* docs, int32_t* freqs, int32_t length)=0;
// Skips entries to the first beyond the current whose document number is
// greater than or equal to <i>target</i>. <p>Returns true iff there is such
// an entry. <p>Behaves as if written: <pre>
// bool skipTo(int32_t target) {
// do {
// if (!next())
// return false;
// } while (target > doc());
// return true;
// }
// </pre>
// Some implementations are considerably more efficient than that.
virtual bool skipTo(const int32_t target)=0;
// Frees associated resources.
virtual void close() = 0;
/** Solve the diamond inheritence problem by providing a reinterpret function.
* No dynamic casting is required and no RTTI data is needed to do this
*/
virtual TermPositions* __asTermPositions()=0;
};
// Abstract class for enumerating terms.
//
//<p>Term enumerations are always ordered by Term.compareTo(). Each term in
//the enumeration is greater than all that precede it.
class TermEnum: LUCENE_BASE {
public:
// Increments the enumeration to the next element. True if one exists.
virtual bool next()=0;
// Returns a pointer to the current Term in the enumeration.
virtual Term* term()=0;
// Returns the current Term in the enumeration.
virtual Term* term(bool pointer){
Term* ret = term();
if ( !pointer )
ret->__cl_decref();
return ret;
}
// Returns the docFreq of the current Term in the enumeration.
virtual int32_t docFreq() const=0;
// Closes the enumeration to further activity, freeing resources.
virtual void close() =0;
virtual ~TermEnum(){
}
// Term Vector support
/** Skips terms to the first beyond the current whose value is
* greater or equal to <i>target</i>. <p>Returns true iff there is such
* an entry. <p>Behaves as if written: <pre>
* public boolean skipTo(Term target) {
* do {
* if (!next())
* return false;
* } while (target > term());
* return true;
* }
* </pre>
* Some implementations are considerably more efficient than that.
*/
virtual bool skipTo(Term* target){
do {
if (!next())
return false;
} while (target->compareTo(term(false)) > 0);
return true;
}
/**
* Because we need to know how to cast the object, we need the objects name.
*/
virtual const char* getObjectName() = 0;
};
/**
* TermPositions provides an interface for enumerating the <document,
* frequency, <position>* > tuples for a term. <p> The document and
* frequency are the same as for a TermDocs. The positions portion lists the ordinal
* positions of each occurrence of a term in a document.
*
* @see IndexReader#termPositions()
*/
class TermPositions: public virtual TermDocs {
public:
// Returns next position in the current document. It is an error to call
// this more than {@link #freq()} times
// without calling {@link #next()}<p> This is
// invalid until {@link #next()} is called for
// the first time.
virtual int32_t nextPosition() = 0;
virtual ~TermPositions(){
}
/** Solve the diamond inheritence problem by providing a reinterpret function.
* No dynamic casting is required and no RTTI data is needed to do this
*/
virtual TermDocs* __asTermDocs()=0;
virtual TermPositions* __asTermPositions()=0;
};
CL_NS_END
#endif
|