blob: b2889687fa9d330ec90cf50445ebb64caa8067c5 (
plain)
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
|
//
// WordStat.h
//
// WordStat: Kind of record that holds statistics about each distinct word
// in the database.
//
// Part of the ht://Dig package <http://www.htdig.org/>
// Copyright (c) 1999-2004 The ht://Dig Group
// For copyright details, see the file COPYING in your distribution
// or the GNU Library General Public License (LGPL) version 2 or later
// <http://www.gnu.org/copyleft/lgpl.html>
//
// $Id: WordStat.h,v 1.5 2004/05/28 13:15:28 lha Exp $
//
#ifndef _WordStat_h_
#define _WordStat_h_
#include "WordReference.h"
class WordStat : public WordReference
{
public:
//
// Construction/Destruction
//
WordStat() { record.type = WORD_RECORD_STATS; }
WordStat(const String& key_arg, const String& record_arg) : WordReference(key_arg, record_arg) {
record.type = WORD_RECORD_STATS;
}
WordStat(const String& word) {
Clear();
key.SetWord(String("\001") + word);
record.type = WORD_RECORD_STATS;
}
~WordStat() {}
//
// Accessors
//
unsigned int Noccurrence() const { return record.info.stats.noccurrence; }
unsigned int &Noccurrence() { return record.info.stats.noccurrence; }
//
// Return upper boundary key of reference count records
//
static inline const WordReference& Last() {
if(!word_stat_last)
word_stat_last = new WordReference("\002");
return *word_stat_last;
}
protected:
static WordReference* word_stat_last;
};
#endif
|