metadataengine/client/src/mdeobjectquery.cpp
changeset 0 c53acadfccc6
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 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:  Interface for object query
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "mdeobjectquery.h"
       
    20 #include "mdeobject.h"
       
    21 
       
    22 
       
    23 CMdEObjectQuery::CMdEObjectQuery(CMdESession& aSession, CMdENamespaceDef& aNamespaceDef, 
       
    24 		CMdEObjectDef& aObjectDef, RPointerArray<CMdEObjectDef>* aObjectDefs)
       
    25         : CMdEQuery(EQueryTypeObject, aSession, aNamespaceDef), 
       
    26           iObjectDef(aObjectDef), iObjectDefs(aObjectDefs),
       
    27           iFreetextsInResult( ETrue )
       
    28     {
       
    29     }
       
    30 
       
    31 void CMdEObjectQuery::ObjectQueryConstructL()
       
    32     {
       
    33     QueryConstructL();
       
    34     }
       
    35 
       
    36 CMdEObjectQuery::~CMdEObjectQuery()
       
    37 	{
       
    38 	// doesn't own property definitions, so only delete pointer array
       
    39 	iPropertyFilters.Close();
       
    40 	}
       
    41 
       
    42 EXPORT_C CMdEObject& CMdEObjectQuery::Result(TInt aIndex) const
       
    43     {
       
    44     return static_cast<CMdEObject&>( ResultItem(aIndex) );
       
    45     }
       
    46 
       
    47 EXPORT_C CMdEObjectDef& CMdEObjectQuery::ObjectDef() const
       
    48 	{
       
    49 	return iObjectDef;
       
    50 	}
       
    51 
       
    52 EXPORT_C void CMdEObjectQuery::AddPropertyFilterL(const CMdEPropertyDef* aProperty)
       
    53     {
       
    54     iPropertyFilters.AppendL( aProperty );
       
    55     }
       
    56 
       
    57 
       
    58 EXPORT_C void CMdEObjectQuery::ResetPropertyFilter()
       
    59     {
       
    60     iPropertyFilters.Reset();
       
    61     }
       
    62     
       
    63 RPointerArray<CMdEPropertyDef>& CMdEObjectQuery::PropertyFilter()
       
    64 	{
       
    65 	return iPropertyFilters;
       
    66 	}
       
    67 
       
    68 RPointerArray<CMdEObjectDef>* CMdEObjectQuery::ObjectDefs() const
       
    69 	{
       
    70 	return iObjectDefs;
       
    71 	}
       
    72 
       
    73 void CMdEObjectQuery::DoCancel() 
       
    74     {
       
    75     SetState( EStateError );
       
    76     }
       
    77