api/termlist.cc

Go to the documentation of this file.
00001 
00004 /* Copyright (C) 2007 Olly Betts
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License as
00008  * published by the Free Software Foundation; either version 2 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 #include <config.h>
00022 
00023 #include "omassert.h"
00024 
00025 #include "termlist.h"
00026 
00027 using namespace std;
00028 
00029 namespace Xapian {
00030 
00031 TermIterator::Internal::~Internal() { }
00032 
00033 void
00034 TermIterator::Internal::accumulate_stats(Xapian::Internal::ExpandStats &) const
00035 {
00036     // accumulate_stats should never get called for some subclasses.
00037     Assert(false);
00038 }
00039 
00040 Xapian::termcount
00041 TermIterator::Internal::get_collection_freq() const
00042 {
00043     // This method isn't currently externally exposed (or used internally).
00044     Assert(false);
00045     return 0;
00046 }
00047 
00048 TermIterator::Internal *
00049 TermIterator::Internal::skip_to(const string & term)
00050 {
00051     // This simple implementation just calls next until we're at or past the
00052     // specified term.  Subclasses can override with a more efficient
00053     // implementation if they are able to provide one.
00054     while (!at_end() && get_termname() < term) {
00055         Internal *tl = next();
00056         if (tl) {
00057             while (!tl->at_end() && tl->get_termname() < term) {
00058                 Internal *ret = tl->next();
00059                 if (ret) {
00060                     delete tl;
00061                     tl = ret;
00062                 }
00063             }
00064             return tl;
00065         }
00066     }
00067 
00068     return NULL;
00069 }
00070 
00071 }

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.