diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeobjectcondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeobjectcondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEOBJECTCONDITION_H__ +#define __MDEOBJECTCONDITION_H__ + + +#include +#include + +/* Forward declarations. */ +class CMdEObjectDef; + + +/** + * Query condition for objects. + */ +NONSHARABLE_CLASS(CMdEObjectCondition) : public CMdECondition + { +public: + + /* Constructors and destructor. */ +/** + * Two-phased constructor. + */ + + static CMdEObjectCondition* NewL( TObjectConditionCompareMethod aCompareMethod, + TItemId aObjectId = KNoId, + const CMdEObjectDef* aObjectDef = NULL, + TInt64 aObjectGuidHigh = 0, TInt64 aObjectGuidLow = 0 ); + + static CMdEObjectCondition* NewLC( TObjectConditionCompareMethod aCompareMethod, + TItemId aObjectId = KNoId, + const CMdEObjectDef* aObjectDef = NULL, + TInt64 aObjectGuidHigh = 0, TInt64 aObjectGuidLow = 0 ); + + static CMdEObjectCondition* NewL( TObjectConditionCompareMethod aCompareMethod, + const RArray* aObjectIds = NULL, + const TDesC* aString = NULL, + const TMdEUintRange* aRange = NULL ); + + static CMdEObjectCondition* NewLC( TObjectConditionCompareMethod aCompareMethod, + const RArray* aObjectIds = NULL, + const TDesC* aString = NULL, + const TMdEUintRange* aRange = NULL ); + + + /** + * Destructor. + */ + virtual ~CMdEObjectCondition(); + + /* Methods. */ + + /** + * Returns the object definition of the condition. + * + * @return Object definition. NULL, if not defined. + */ + IMPORT_C const CMdEObjectDef* ObjectDef() const; + + /** + * Returns the object ID number of the condition. + * + * @return Object ID. Zero, if not defined. + */ + IMPORT_C TItemId ObjectId() const; + + /** + * Returns the object ID numbers of the condition. + * + * @return Object IDs. NULL, if not defined. + */ + IMPORT_C const RArray* ObjectIds() const; + + /** + * Returns the string of the condition. + * + * @return String descriptor. NULL, if not defined. + */ + IMPORT_C const TDesC* String() const; + + /** + * Returns the comparison method of the condition. + * + * @return Comparison method. + */ + IMPORT_C TObjectConditionCompareMethod CompareMethod() const; + + /** + * Returns the level of confidentiality of the condition. + * + * @return Confidentiality level of condition. + */ + IMPORT_C TObjectConditionConfidentialityLevel ConfidentialityLevel() const; + + /** + * Sets the confidentiality level for the condition. + * Default level is ELevelNormal. + * + * @param aLevel focuses the search to confidential or + * non-confidential objects or both of them. + */ + IMPORT_C void SetConfidentialityLevel( TObjectConditionConfidentialityLevel aLevel ); + + /** + * Determines whether the condition requires the object + * to be a present object or not. + * + * @return ETrue, if not present objects are requested; + * EFalse otherwise. + */ + IMPORT_C TBool NotPresent() const; + + /** + * Sets whether the condition requires the object + * to be a present object or not. + * + * @param aNotPresent ETrue, if the object should + * be a not present object. + * EFalse otherwise. + */ + IMPORT_C void SetNotPresent(TBool aNotPresent); + + /** + * Determines whether the condition requires the object + * to be a not placeholder object. + * + * @return ETrue, if not placeholder objects are excluded; + * EFalse otherwise. + */ + IMPORT_C TBool NotPlaceholder() const; + + /** + * Sets whether the condition requires the object + * to be a not placeholder object. + * + * @param aNotPlaceholder ETrue, if the object should + * be a not placeholder object. + * EFalse otherwise. + */ + IMPORT_C void SetNotPlaceholder(TBool aNotPlaceholder); + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + + /** + * Determines whether the condition requires the object + * to be a not placeholder object. + * + * @return ETrue, if not placeholder objects are excluded; + * EFalse otherwise. + */ + IMPORT_C TBool PlaceholderOnly() const; + + /** + * Sets whether the condition requires the object + * to be a not placeholder object. + * + * @param aNotPlaceholder ETrue, if the object should + * be a not placeholder object. + * EFalse otherwise. + */ + IMPORT_C void SetPlaceholderOnly( TBool aPlaceholderOnly ); + +private: + + /** + * Constructor. + * + * @param aCompareMethod Comparison method. + * @param aObjectId ID number of an object. + * @param aObjectDef Object definition. + * @param aObjectGuidHigh object's GUID high part. + * @param aObjectGuidLow object's GUID low part. + */ + CMdEObjectCondition( TObjectConditionCompareMethod aCompareMethod, + TItemId aObjectId, const CMdEObjectDef* aObjectDef, + TInt64 aObjectGuidHigh, TInt64 aObjectGuidLow ); + + /** + * Constructor. + * + * @param aCompareMethod Comparison method. + */ + CMdEObjectCondition( TObjectConditionCompareMethod aCompareMethod ); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + /** + * Second-phase constructor. + * + * @param aString Text string to look for. + * @param aObjectIds object IDs to look for. + */ + void ConstructL( const RArray* aObjectIds, + const TDesC* aString, const TMdEUintRange* aRange ); + +private: + + /** Object definition to match. NULL, if not applicable. */ + const CMdEObjectDef* iObjectDef; + + /** The object's ID. */ + TItemId iObjectId; + + /** The objects' ID. */ + RArray* iObjectIds; + + /** String to match. NULL, if not applicable. */ + HBufC* iString; + + /** Compare method for the string. */ + TObjectConditionCompareMethod iCompareMethod; + + /** + * Object condition flags + * not present + * not placeholder + */ + TUint32 iFlags; + + /** + * Determines confidentiality level of result object. + * By default level is ELevelNormal, which means that + * query returns only non-confidential objects as result. + */ + TObjectConditionConfidentialityLevel iConfidentialityLevel; + + /** Object's GUID high part. */ + TInt64 iGuidHigh; + + /** Object's GUID low part. */ + TInt64 iGuidLow; + + TMdEUintRange* iRange; + TBool iPlaceholdersOnly; + }; + +#endif // __MDEOBJECTCONDITION_H__