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 <xapian/expanddecider.h> 00024 00025 using namespace std; 00026 00027 namespace Xapian { 00028 00029 ExpandDecider::~ExpandDecider() { } 00030 00031 bool 00032 ExpandDeciderAnd::operator()(const string &term) const 00033 { 00034 return first(term) && second(term); 00035 } 00036 00037 bool 00038 ExpandDeciderFilterTerms::operator()(const string &term) const 00039 { 00040 /* Some older compilers (such as Sun's CC) return an iterator from find() 00041 * and a const_iterator from end() in this situation, and then can't 00042 * compare the two! We workaround this problem by explicitly assigning the 00043 * result of find() to a const_iterator. */ 00044 set<string>::const_iterator i = rejects.find(term); 00045 return i == rejects.end(); 00046 } 00047 00048 }