Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __RD_ORQUERY_H__
00011 #define __RD_ORQUERY_H__
00012
00013 #include "Query.h"
00014
00015 namespace Queries {
00016
00017 template <class MatchFuncArgType, class DataFuncArgType=MatchFuncArgType,
00018 bool needsConversion=false>
00019 class OrQuery : public Query<MatchFuncArgType, DataFuncArgType,needsConversion> {
00020
00021 public:
00022 typedef Query<MatchFuncArgType, DataFuncArgType,needsConversion> BASE;
00023 OrQuery() {
00024 this->df_negate = false;
00025 };
00026
00027 bool Match(const DataFuncArgType what) const {
00028 bool res = false;
00029 typename BASE::CHILD_VECT_CI it1;
00030 for(it1=this->beginChildren();
00031 it1!=this->endChildren();
00032 ++it1){
00033 bool tmp = (*it1)->Match(what);
00034 if( tmp ){
00035 res = true;
00036 break;
00037 }
00038 }
00039 if( this->getNegation() ) res = !res;
00040 return res;
00041 };
00042
00043 Query<MatchFuncArgType,DataFuncArgType,needsConversion> *
00044 copy( ) const {
00045 OrQuery<MatchFuncArgType,DataFuncArgType,needsConversion> *res =
00046 new OrQuery<MatchFuncArgType,DataFuncArgType,needsConversion>();
00047
00048 typename BASE::CHILD_VECT_CI i;
00049 for(i=this->beginChildren();
00050 i!=this->endChildren();
00051 ++i){
00052 res->addChild(*i);
00053 }
00054 res->setNegation(this->getNegation());
00055 res->d_description = this->d_description;
00056 return res;
00057 };
00058 };
00059
00060 }
00061 #endif