metadataengine/client/inc/mdequeryimpl.h
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of object, relation and event query
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MDEQUERYIMPL_H__
       
    20 #define __MDEQUERYIMPL_H__
       
    21 
       
    22 #include "mdeobjectquery.h"
       
    23 #include "mderelationquery.h"
       
    24 #include "mdeeventquery.h"
       
    25 
       
    26 // Forward declaration
       
    27 class CMdESessionImpl;
       
    28 class CMdENamespaceDef;
       
    29 class CMdEObjectDef;
       
    30 class RMdEEngineSession;
       
    31 class CMdEAsynchronousFindAO;
       
    32 
       
    33 /**
       
    34  * Object query implementation.
       
    35  */
       
    36 NONSHARABLE_CLASS(CMdEObjectQueryImpl) : public CMdEObjectQuery
       
    37 	{
       
    38 public:
       
    39 
       
    40     /* Constructors and destructor. */
       
    41 	/**
       
    42 	 * Two-phased constructor.
       
    43 	 */
       
    44 	static CMdEObjectQueryImpl* NewL( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef, 
       
    45 			CMdEObjectDef& aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs,
       
    46 			RMdEEngineSession& aSession );
       
    47 	
       
    48 	static CMdEObjectQueryImpl* NewLC( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef, 
       
    49 			CMdEObjectDef& aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs,
       
    50 			RMdEEngineSession& aSession );
       
    51 
       
    52 	/**
       
    53 	 * Destructor.
       
    54 	 */
       
    55 	virtual ~CMdEObjectQueryImpl();
       
    56 
       
    57 
       
    58     /* Methods. */
       
    59 
       
    60     /**
       
    61      * As in CMdEQuery.
       
    62 	 */
       
    63     void DoFindL( TUint aMaxCount, TUint aNotifyCount );
       
    64 
       
    65     /**
       
    66      * Notifies results
       
    67 	 */
       
    68     void DoNotifyResultsL( RPointerArray<CMdEInstanceItem>& aResultList );
       
    69 
       
    70     /**
       
    71      * Notifies results of id query
       
    72 	 */
       
    73     void DoNotifyResultsL( RArray<TItemId>& aResultIdList );
       
    74 
       
    75     /**
       
    76      * Notifies result of distinct values query
       
    77      */
       
    78     void DoNotifyResultsL( CDesCArray& aResults );
       
    79 
       
    80     /**
       
    81      * Notifies result of count query
       
    82 	 */
       
    83     void DoNotifyResults( TInt aResultCount );
       
    84     
       
    85     /**
       
    86      * Notifies query completed
       
    87 	 */
       
    88     void DoNotifyCompleted( TInt aError );
       
    89 
       
    90 protected:
       
    91     
       
    92     /**
       
    93      * As in CMdEQuery.
       
    94      */
       
    95     void DoCancel();
       
    96     
       
    97 private:
       
    98 	/**
       
    99 	 * Constructor. Note that new queries should be created using the factory
       
   100 	 * @param aSessionImpl the session
       
   101 	 */
       
   102 	CMdEObjectQueryImpl( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef, 
       
   103 			CMdEObjectDef& aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs );
       
   104 	
       
   105 	/**
       
   106 	 * Second-phase constructor.
       
   107 	 * @param aSession reference to the engine session
       
   108 	 */
       
   109 	void ConstructL( CMdESessionImpl& aSessionImpl, RMdEEngineSession& aSession );
       
   110 
       
   111     
       
   112 private:
       
   113 
       
   114 	/** Asynchronous find support. */
       
   115 	CMdEAsynchronousFindAO* iAsyncFind;
       
   116     };
       
   117 
       
   118 /**
       
   119  * Relation query stub implementation.
       
   120  */
       
   121 class CMdERelationQueryImpl
       
   122     : public CMdERelationQuery
       
   123 	{
       
   124 public:
       
   125 
       
   126     /* Constructors and destructor. */
       
   127 	/**
       
   128 	 * Two-phased constructor.
       
   129 	 */
       
   130 	static CMdERelationQueryImpl* NewL( CMdESessionImpl& aSessionImpl,
       
   131 			CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession );
       
   132 	
       
   133 	static CMdERelationQueryImpl* NewLC( CMdESessionImpl& aSessionImpl,
       
   134 			CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession );
       
   135 	
       
   136 	/**
       
   137 	 * Destructor.
       
   138 	 */
       
   139 	virtual ~CMdERelationQueryImpl();
       
   140 
       
   141 
       
   142     /* Methods from CMdERelationQuery. */
       
   143 
       
   144     /**
       
   145      * As in CMdEQuery.
       
   146 	 */
       
   147     void DoFindL( TUint aMaxCount, TUint aNotifyCount );
       
   148 
       
   149     /**
       
   150      * Notifies results
       
   151 	 */
       
   152     void DoNotifyResultsL( RPointerArray<CMdEInstanceItem>& aResultList );
       
   153 
       
   154     /**
       
   155      * Notifies results of id query
       
   156 	 */
       
   157     void DoNotifyResultsL( RArray<TItemId>& aResultIdList );
       
   158 
       
   159     /**
       
   160      * Notifies result of count query
       
   161 	 */
       
   162     void DoNotifyResults( TUint32 aResultCount );
       
   163 
       
   164     /**
       
   165      * Notifies query completed
       
   166 	 */
       
   167     void DoNotifyCompleted( TInt aError );
       
   168 
       
   169 protected:
       
   170  
       
   171     /**
       
   172      * As in CMdEQuery.
       
   173      */
       
   174     void DoCancel();
       
   175     
       
   176 private:
       
   177 	/**
       
   178 	 * Constructs a new relation query in the specified session.
       
   179 	 * @param aSessionImpl the session
       
   180 	 */
       
   181 	CMdERelationQueryImpl( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef );
       
   182 	
       
   183 	/**
       
   184 	 * Second-phase constructor.
       
   185 	 * @param aSession reference to the engine session
       
   186 	 */
       
   187 	void ConstructL( CMdESessionImpl& aSessionImpl, RMdEEngineSession& aSession );
       
   188 
       
   189     
       
   190 private:
       
   191 
       
   192 	/** Asynchronous find support. */
       
   193 	CMdEAsynchronousFindAO* iAsyncFind;
       
   194     };
       
   195 
       
   196 /**
       
   197  * Event query implementation.
       
   198  */
       
   199 class CMdEEventQueryImpl: public CMdEEventQuery
       
   200 	{
       
   201 public:
       
   202 
       
   203     /* Constructors and destructor. */
       
   204 
       
   205 	static CMdEEventQueryImpl* NewL( CMdESessionImpl& aSessionImpl,
       
   206 		CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession );
       
   207 
       
   208 	static CMdEEventQueryImpl* NewLC( CMdESessionImpl& aSessionImpl,
       
   209 		CMdENamespaceDef& aNamespaceDef, RMdEEngineSession& aSession );
       
   210 
       
   211 	/**
       
   212 	 * Destructor.
       
   213 	 */
       
   214 	virtual ~CMdEEventQueryImpl();
       
   215 
       
   216 
       
   217     /* Methods from CMdEEventQuery. */
       
   218 
       
   219     /**
       
   220      * As in CMdEQuery.
       
   221 	 */
       
   222     void DoFindL( TUint aMaxCount, TUint aNotifyCount );
       
   223 
       
   224     /**
       
   225      * Notifies results
       
   226 	 */
       
   227     void DoNotifyResultsL( RPointerArray<CMdEInstanceItem>& aResultList );
       
   228 
       
   229     /**
       
   230      * Notifies results of id query
       
   231 	 */
       
   232     void DoNotifyResultsL( RArray<TItemId>& aResultIdList );
       
   233 
       
   234     /**
       
   235      * Notifies result of count query
       
   236 	 */
       
   237     void DoNotifyResults( TUint32 aResultCount );
       
   238 
       
   239     /**
       
   240      * Notifies query completed
       
   241 	 */
       
   242     void DoNotifyCompleted( TInt aError );
       
   243 
       
   244 protected:
       
   245     
       
   246     /**
       
   247      * As in CMdEQuery.
       
   248      */
       
   249     void DoCancel();
       
   250     
       
   251 private:
       
   252 	/**
       
   253 	 * Constructs a new event query in the specified session.
       
   254 	 * @param aSessionImpl the session
       
   255 	 */
       
   256 	CMdEEventQueryImpl( CMdESessionImpl& aSessionImpl, CMdENamespaceDef& aNamespaceDef );
       
   257 	
       
   258 	/**
       
   259 	 * Second-phase constructor. 
       
   260 	 * @param aSession reference to the engine session
       
   261 	 */
       
   262 	void ConstructL( CMdESessionImpl& aSessionImpl, RMdEEngineSession& aSession );
       
   263 
       
   264     
       
   265 private:
       
   266 
       
   267 	/** Asynchronous find support. */
       
   268 	CMdEAsynchronousFindAO* iAsyncFind;
       
   269 	};
       
   270 
       
   271 #endif  // __MDEQUERYIMPL_H__