xapian-core  1.4.26
glass_spellingwordslist.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2005,2008,2009,2010,2011 Olly Betts
5  * Copyright (C) 2007 Lemur Consulting Ltd
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef XAPIAN_HGUARD_GLASS_SPELLINGWORDSLIST_H
23 #define XAPIAN_HGUARD_GLASS_SPELLINGWORDSLIST_H
24 
25 #include "backends/alltermslist.h"
26 #include "backends/database.h"
27 #include "glass_spelling.h"
28 #include "glass_cursor.h"
29 
33 
35  void operator=(const GlassSpellingWordsList &);
36 
39 
44 
52 
54  void read_termfreq() const;
55 
56  public:
58  GlassCursor * cursor_)
59  : database(database_), cursor(cursor_), termfreq(0) {
60  // Seek to the entry before the first key with a "W" prefix, so the
61  // first next() will advance us to the first such entry.
62  cursor->find_entry(std::string("W", 1));
63  }
64 
67 
73  std::string get_termname() const;
74 
81 
83  TermList * next();
84 
86  TermList * skip_to(const std::string &tname);
87 
89  bool at_end() const;
90 };
91 
92 #endif /* XAPIAN_HGUARD_GLASS_SPELLINGWORDSLIST_H */
GlassCursor * cursor
A cursor which runs through the spelling table reading termnames from the keys.
GlassSpellingWordsList(const GlassSpellingWordsList &)
Copying is not allowed.
Xapian::Internal::intrusive_ptr< const Xapian::Database::Internal > database
Keep a reference to our database to stop it being deleted.
std::string get_termname() const
Returns the current termname.
Abstract base class for termlists.
Definition: termlist.h:39
GlassSpellingWordsList(Xapian::Internal::intrusive_ptr< const Xapian::Database::Internal > database_, GlassCursor *cursor_)
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
Definition: types.h:72
void operator=(const GlassSpellingWordsList &)
Assignment is not allowed.
Xapian::termcount termfreq
The term frequency of the term at the current position.
Xapian::doccount get_termfreq() const
Returns the term frequency of the current term.
Abstract base class for iterating all terms in a database.
A cursor pointing to a position in a Btree table, for reading several entries in order, or finding approximate matches.
Definition: glass_cursor.h:147
TermList * skip_to(const std::string &tname)
Advance to the first term which is >= tname.
void read_termfreq() const
Read and cache the term frequency.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:38
Interface to Btree cursors.
bool at_end() const
True if we&#39;re off the end of the list.
Abstract base class for iterating all terms in a database.
Definition: alltermslist.h:27
bool find_entry(const string &key)
Position the cursor on the highest entry with key <= key.
TermList * next()
Advance to the next term in the list.
Spelling correction data for a glass database.