| 1 | /** @file |
| 2 | * @brief A termlist containing all words which are spelling targets. |
| 3 | */ |
| 4 | /* Copyright (C) 2005,2008,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_CHERT_SPELLINGWORDSLIST_H |
| 23 | #define XAPIAN_HGUARD_CHERT_SPELLINGWORDSLIST_Hcxx . . $ `backends/chert/chert_spellingwordslist.h:23:9`! |
| 24 | |
| 25 | #include "backends/alltermslist.h"cxx . . $ `<file>/backends/alltermslist.h`/ |
| 26 | #include "backends/database.h"cxx . . $ `<file>/backends/database.h`/ |
| 27 | #include "chert_spelling.h"cxx . . $ `<file>/backends/chert/chert_spelling.h`/ |
| 28 | |
| 29 | class ChertCursorcxx . . $ ChertCursor#; |
| 30 | |
| 31 | class ChertSpellingWordsListcxx . . $ ChertSpellingWordsList# : public AllTermsListcxx . . $ AllTermsList# { |
| 32 | /// Copying is not allowed. |
| 33 | ChertSpellingWordsListcxx . . $ ChertSpellingWordsList#ChertSpellingWordsList(e641f0fc53d7dbef).(const ChertSpellingWordsListcxx . . $ ChertSpellingWordsList# &); |
| 34 | |
| 35 | /// Assignment is not allowed. |
| 36 | void operatorcxx . . $ ChertSpellingWordsList#`operator=`(e641f0fc53d7dbef).=(const ChertSpellingWordsListcxx . . $ ChertSpellingWordsList# &); |
| 37 | |
| 38 | /// Keep a reference to our database to stop it being deleted. |
| 39 | Xapiancxx . . $ Xapian/::Internalcxx . . $ Xapian/Internal/::intrusive_ptrcxx . . $ Xapian/Internal/intrusive_ptr#<const Xapiancxx . . $ Xapian/::Databasecxx . . $ Xapian/Database#::Internalcxx . . $ Xapian/Database#Internal#> databasecxx . . $ ChertSpellingWordsList#database.; |
| 40 | |
| 41 | /** A cursor which runs through the spelling table reading termnames from |
| 42 | * the keys. |
| 43 | */ |
| 44 | ChertCursorcxx . . $ ChertCursor# * cursorcxx . . $ ChertSpellingWordsList#cursor.; |
| 45 | |
| 46 | /** The term frequency of the term at the current position. |
| 47 | * |
| 48 | * If this value is zero, then we haven't read the term frequency or |
| 49 | * collection frequency for the current term yet. We need to call |
| 50 | * read_termfreq() to read these. |
| 51 | */ |
| 52 | mutable Xapiancxx . . $ Xapian/::termcountcxx . . $ Xapian/termcount# termfreqcxx . . $ ChertSpellingWordsList#termfreq.; |
| 53 | |
| 54 | /// Read and cache the term frequency. |
| 55 | void read_termfreqcxx . . $ ChertSpellingWordsList#read_termfreq(83f5f38750778ac8).() const; |
| 56 | |
| 57 | public: |
| 58 | ChertSpellingWordsListcxx . . $ ChertSpellingWordsList#ChertSpellingWordsList(94edf45f24c82c0).(Xapiancxx . . $ Xapian/::Internalcxx . . $ Xapian/Internal/::intrusive_ptrcxx . . $ Xapian/Internal/intrusive_ptr#<const Xapiancxx . . $ Xapian/::Databasecxx . . $ Xapian/Database#::Internalcxx . . $ Xapian/Database#Internal#> database_, |
| 59 | ChertCursorcxx . . $ ChertCursor# * cursor_) |
| 60 | : databasecxx . . $ Xapian/Internal/intrusive_ptr#intrusive_ptr(1f1e08aa4d15111e).(database_), cursorcxx . . $ ChertSpellingWordsList#cursor.(cursor_), termfreqcxx . . $ ChertSpellingWordsList#termfreq.(0) { |
| 61 | // Seek to the entry before the first key with a "W" prefix, so the |
| 62 | // first next() will advance us to the first such entry. |
| 63 | cursorcxx . . $ ChertSpellingWordsList#cursor.->find_entrycxx . . $ ChertCursor#find_entry(7c222eea44a24d43).(stdcxx . . $ std/__cxx11/basic_string#basic_string(f26a9578972d3fae).::stringcxx . . $ std/string#("W", 1)); |
| 64 | } |
| 65 | |
| 66 | /// Destructor. |
| 67 | ~cxx . . $ ChertSpellingWordsList#`~ChertSpellingWordsList`(ced63f7c635d850d).ChertSpellingWordsListcxx . . $ ChertSpellingWordsList#(); |
| 68 | |
| 69 | /** Returns the current termname. |
| 70 | * |
| 71 | * Either next() or skip_to() must have been called before this |
| 72 | * method can be called. |
| 73 | */ |
| 74 | stdcxx . . $ std/::stringcxx . . $ std/string# get_termnamecxx . . $ ChertSpellingWordsList#get_termname(219584694fe2b248).() const; |
| 75 | |
| 76 | /** Returns the term frequency of the current term. |
| 77 | * |
| 78 | * Either next() or skip_to() must have been called before this |
| 79 | * method can be called. |
| 80 | */ |
| 81 | Xapiancxx . . $ Xapian/::doccountcxx . . $ Xapian/doccount# get_termfreqcxx . . $ ChertSpellingWordsList#get_termfreq(ddd8539a2fcdd4ce).() const; |
| 82 | |
| 83 | /// Advance to the next term in the list. |
| 84 | TermListcxx . . $ TermList# * nextcxx . . $ ChertSpellingWordsList#next(cd86c745428e820f).(); |
| 85 | |
| 86 | /// Advance to the first term which is >= tname. |
| 87 | TermListcxx . . $ TermList# * skip_tocxx . . $ ChertSpellingWordsList#skip_to(c2d075377a6ea65f).(const stdcxx . . $ std/::stringcxx . . $ std/string# &tname); |
| 88 | |
| 89 | /// True if we're off the end of the list |
| 90 | bool at_endcxx . . $ ChertSpellingWordsList#at_end(50ce9a9e25b4a850).() const; |
| 91 | }; |
| 92 | |
| 93 | #endif /* XAPIAN_HGUARD_CHERT_SPELLINGWORDSLIST_H */ |