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