summaryrefslogtreecommitdiffstats
path: root/3rdparty/clucene/src/CLucene/search/BooleanClause.h
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit50123887ba0f33cf47520bee7c419d68742af2d1 (patch)
tree0eb8679b9e4e4370e59b44bfdcae616816e39aca /3rdparty/clucene/src/CLucene/search/BooleanClause.h
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to '3rdparty/clucene/src/CLucene/search/BooleanClause.h')
-rw-r--r--3rdparty/clucene/src/CLucene/search/BooleanClause.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/3rdparty/clucene/src/CLucene/search/BooleanClause.h b/3rdparty/clucene/src/CLucene/search/BooleanClause.h
new file mode 100644
index 000000000..b89cb31d7
--- /dev/null
+++ b/3rdparty/clucene/src/CLucene/search/BooleanClause.h
@@ -0,0 +1,90 @@
+/*------------------------------------------------------------------------------
+* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
+*
+* Distributable under the terms of either the Apache License (Version 2.0) or
+* the GNU Lesser General Public License, as specified in the COPYING file.
+------------------------------------------------------------------------------*/
+#ifndef _lucene_search_BooleanClause_
+#define _lucene_search_BooleanClause_
+
+#if defined(_LUCENE_PRAGMA_ONCE)
+# pragma once
+#endif
+#include "SearchHeader.h"
+
+CL_NS_DEF(search)
+ // A clause in a BooleanQuery.
+ class BooleanClause:LUCENE_BASE {
+ public:
+ class Compare:public CL_NS_STD(binary_function)<const BooleanClause*,const BooleanClause*,bool>
+ {
+ public:
+ bool operator()( const BooleanClause* val1, const BooleanClause* val2 ) const{
+ return val1->equals(val2);
+ }
+ };
+
+ // The query whose matching documents are combined by the boolean query.
+ Query* query;
+
+ int32_t getClauseCount();
+
+ // If true, documents documents which <i>do not</i>
+ // match this sub-query will <i>not</i> match the boolean query.
+ bool required;
+
+ // If true, documents documents which <i>do</i>
+ // match this sub-query will <i>not</i> match the boolean query.
+ bool prohibited;
+
+ bool deleteQuery;
+
+ // Constructs a BooleanClause with query <code>q</code>, required
+ // <code>r</code> and prohibited <code>p</code>.
+ BooleanClause(Query* q, const bool DeleteQuery,const bool req, const bool p):
+ query(q),
+ required(req),
+ prohibited(p),
+ deleteQuery(DeleteQuery)
+ {
+ }
+
+ BooleanClause(const BooleanClause& clone):
+#if defined(LUCENE_ENABLE_MEMLEAKTRACKING)
+#elif defined(LUCENE_ENABLE_REFCOUNT)
+#else
+ LuceneVoidBase(),
+#endif
+ query(clone.query->clone()),
+ required(clone.required),
+ prohibited(clone.prohibited),
+ deleteQuery(true)
+ {
+ }
+
+ BooleanClause* clone() const{
+ BooleanClause* ret = _CLNEW BooleanClause(*this);
+ return ret;
+ }
+
+ ~BooleanClause(){
+ if ( deleteQuery )
+ _CLDELETE( query );
+ }
+
+ /** Returns true iff <code>o</code> is equal to this. */
+ bool equals(const BooleanClause* other) const {
+ return this->query->equals(other->query)
+ && (this->required == other->required)
+ && (this->prohibited == other->prohibited);
+ }
+
+ size_t hashCode() const{
+ return query->hashCode() ^ (this->required?1:0) ^ (this->prohibited?2:0);
+ }
+ };
+
+
+CL_NS_END
+#endif
+