sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __LOGFILTQ__ sl@0: #define __LOGFILTQ__ sl@0: sl@0: #include sl@0: #include sl@0: #include "LogDynBuf.h" sl@0: #include "LogCliServShared.h" sl@0: sl@0: // Classes referenced sl@0: class CLogFilter; sl@0: class CLogFilterList; sl@0: class MLogServDatabaseTransactionInterface; sl@0: sl@0: /** sl@0: This class provides only one public method (apart from constructor) - BuildExprLC(). sl@0: BuildExprLC() accepts as an input parameter a list with view filters and constructs from them sl@0: a "WHERE" SQL expression that is returned to the caller into the RLogDynBuf output parameter. sl@0: sl@0: @see CLogFilterList sl@0: @see RLogDynBuf sl@0: @see MLogServDatabaseTransactionInterface sl@0: @internalComponent sl@0: */ sl@0: class TLogFilterExprBuilder sl@0: { sl@0: public: sl@0: TLogFilterExprBuilder(MLogServDatabaseTransactionInterface& aDatabase); sl@0: void BuildExprLC(RLogDynBuf& aExpr, const CLogFilterList& aFilterList, const TDesC& aInitial, sl@0: TLogFilterConstructionType aType = ELogFilterConstructFilterByFilterFieldByField); sl@0: sl@0: private: sl@0: void DoNextProcessFilterByFilterFieldByFieldL(RLogDynBuf& aExpr); sl@0: void DoNextProcessFieldByFieldFilterByFilterL(RLogDynBuf& aExpr); sl@0: void MakePredicatesL(); sl@0: void MakeConditionL(RLogDynBuf& aExpr); sl@0: void MakeFlagPredicatesL(); sl@0: const TDesC& ColumnName() const; sl@0: void MakeNullPredicate(TDes& aDes); sl@0: void MakePredicateL(TDes& aDes, const CLogFilter& aFilter); sl@0: TBool IsDuplicateNullField() const; sl@0: TBool IsDuplicateField(const CLogFilter& aFilter) const; sl@0: TBool IsFieldEmpty(const CLogFilter& aFilter) const; sl@0: TBool IsDuplicate(const CLogFilter& aFilter1, const CLogFilter& aFilter2) const; sl@0: void Invariant() const; sl@0: sl@0: private: sl@0: MLogServDatabaseTransactionInterface& iDatabase; sl@0: const CLogFilterList* iFilterList; sl@0: const TDesC* iInitial; sl@0: TLogFilterConstructionType iConstructionType; sl@0: TInt iFilterIndex; sl@0: TUint16 iField; //It must be 16-bit. The iField value is read from a resource file. sl@0: //See CLogServRecentCondition::ConstructL() implementation. sl@0: //The iField type width then restricts the max number of field macro values - sl@0: //ELogContactField...ELogSimIdField. sl@0: TInt iFlagIndex; sl@0: CDesCArrayFlat* iPredicateList; sl@0: }; sl@0: sl@0: #endif