mds_plat/metadata_engine_api/inc/mdeobjectcondition.h
changeset 58 fe894bb075c2
parent 51 87e65c44ff3a
child 60 79f826a55db2
equal deleted inserted replaced
51:87e65c44ff3a 58:fe894bb075c2
     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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __MDEOBJECTCONDITION_H__
       
    20 #define __MDEOBJECTCONDITION_H__
       
    21 
       
    22 
       
    23 #include <mdecondition.h>
       
    24 #include <mderange.h>
       
    25 
       
    26 /* Forward declarations. */
       
    27 class CMdEObjectDef;
       
    28 
       
    29 
       
    30 /**
       
    31  * Query condition for objects.
       
    32  */
       
    33 NONSHARABLE_CLASS(CMdEObjectCondition) : public CMdECondition
       
    34 	{
       
    35 public:
       
    36 
       
    37 	/* Constructors and destructor. */
       
    38 /**
       
    39  * Two-phased constructor.
       
    40  */
       
    41 
       
    42 	static CMdEObjectCondition* NewL( TObjectConditionCompareMethod aCompareMethod,
       
    43 			TItemId aObjectId = KNoId, 
       
    44 			const CMdEObjectDef* aObjectDef = NULL,
       
    45 			TInt64 aObjectGuidHigh = 0, TInt64 aObjectGuidLow = 0 );
       
    46 
       
    47 	static CMdEObjectCondition* NewLC( TObjectConditionCompareMethod aCompareMethod,
       
    48 			TItemId aObjectId = KNoId,
       
    49 			const CMdEObjectDef* aObjectDef = NULL,
       
    50 			TInt64 aObjectGuidHigh = 0, TInt64 aObjectGuidLow = 0 );
       
    51 
       
    52 	static CMdEObjectCondition* NewL( TObjectConditionCompareMethod aCompareMethod,
       
    53 			const RArray<TItemId>* aObjectIds = NULL,
       
    54 			const TDesC* aString = NULL,
       
    55 			const TMdEUintRange* aRange = NULL );
       
    56 
       
    57 	static CMdEObjectCondition* NewLC( TObjectConditionCompareMethod aCompareMethod,
       
    58 			const RArray<TItemId>* aObjectIds = NULL,
       
    59 			const TDesC* aString = NULL,
       
    60 			const TMdEUintRange* aRange = NULL );
       
    61 
       
    62 
       
    63 	/**
       
    64 	 * Destructor.
       
    65 	 */
       
    66 	virtual ~CMdEObjectCondition();
       
    67 
       
    68 	/* Methods. */
       
    69 
       
    70     /**
       
    71      * Returns the object definition of the condition.
       
    72      *
       
    73      * @return  Object definition. <code>NULL</code>, if not defined.
       
    74      */
       
    75 	IMPORT_C const CMdEObjectDef* ObjectDef() const;
       
    76 
       
    77     /**
       
    78      * Returns the object ID number of the condition.
       
    79      *
       
    80      * @return  Object ID. Zero, if not defined.
       
    81      */
       
    82     IMPORT_C TItemId ObjectId() const;
       
    83 
       
    84     /**
       
    85      * Returns the object ID numbers of the condition.
       
    86      *
       
    87      * @return  Object IDs. <code>NULL</code>, if not defined.
       
    88      */
       
    89     IMPORT_C const RArray<TItemId>* ObjectIds() const;
       
    90 
       
    91     /**
       
    92      * Returns the string of the condition.
       
    93      *
       
    94      * @return  String descriptor. <code>NULL</code>, if not defined.
       
    95      */
       
    96     IMPORT_C const TDesC* String() const;
       
    97 
       
    98     /**
       
    99      * Returns the comparison method of the condition.
       
   100      *
       
   101      * @return  Comparison method.
       
   102      */
       
   103     IMPORT_C TObjectConditionCompareMethod CompareMethod() const;
       
   104 
       
   105     /**
       
   106      * Returns the level of confidentiality of the condition.
       
   107      *
       
   108      * @return  Confidentiality level of condition.
       
   109      */
       
   110     IMPORT_C TObjectConditionConfidentialityLevel ConfidentialityLevel() const;
       
   111 
       
   112     /**
       
   113      * Sets the confidentiality level for the condition.
       
   114      * Default level is ELevelNormal.
       
   115      *
       
   116      * @param  aLevel focuses the search to confidential or
       
   117      *         non-confidential  objects or both of them.
       
   118      */
       
   119     IMPORT_C void SetConfidentialityLevel( TObjectConditionConfidentialityLevel aLevel );
       
   120 
       
   121     /**
       
   122      * Determines whether the condition requires the object
       
   123      * to be a present object or not.
       
   124      *
       
   125      * @return  <code>ETrue</code>, if not present objects are requested;
       
   126      *          <code>EFalse</code> otherwise.
       
   127      */
       
   128     IMPORT_C TBool NotPresent() const;
       
   129 
       
   130     /** 
       
   131      * Sets whether the condition requires the object
       
   132      * to be a present object or not.
       
   133      *
       
   134      * @param aNotPresent  <code>ETrue</code>, if the object should 
       
   135      *                                         be a not present object.
       
   136      *                     <code>EFalse</code> otherwise.
       
   137      */
       
   138     IMPORT_C void SetNotPresent(TBool aNotPresent);
       
   139 
       
   140     /**
       
   141      * Determines whether the condition requires the object
       
   142      * to be a not placeholder object.
       
   143      *
       
   144      * @return  <code>ETrue</code>, if not placeholder objects are excluded;
       
   145      *          <code>EFalse</code> otherwise.
       
   146      */
       
   147     IMPORT_C TBool NotPlaceholder() const;
       
   148 
       
   149     /** 
       
   150      * Sets whether the condition requires the object
       
   151      * to be a not placeholder object.
       
   152      *
       
   153      * @param aNotPlaceholder  <code>ETrue</code>, if the object should 
       
   154      *                                             be a not placeholder object.
       
   155      *                         <code>EFalse</code> otherwise.
       
   156      */
       
   157     IMPORT_C void SetNotPlaceholder(TBool aNotPlaceholder);
       
   158 
       
   159     /**
       
   160      * Get possible query's internal optimization flags from condition.
       
   161      *
       
   162      * @param aFlaga query's internal optimization flags
       
   163      * @return last level internal optimization flags
       
   164      */
       
   165     TUint32 InternalQueryOptimizationFlags(TUint32& aFlags);
       
   166 
       
   167     /**
       
   168      * Get required size of serialized buffer when this is serialized.
       
   169      *
       
   170      * @return required size of serialized buffer
       
   171      */
       
   172     TUint32 RequiredBufferSize() const;
       
   173 
       
   174     /**
       
   175      * Serialize own data to serialized buffer (correct position must be set 
       
   176      * before calling) and return new position of serialized buffer.
       
   177 	 *
       
   178      * @param aBuffer  serialized buffer.
       
   179      */
       
   180     void SerializeL(CMdCSerializationBuffer& aBuffer,
       
   181     		TMdCOffset& aFreespaceOffset) const;
       
   182     
       
   183     /**
       
   184      * Determines whether the condition requires the object
       
   185      * to be a not placeholder object.
       
   186      *
       
   187      * @return  <code>ETrue</code>, if not placeholder objects are excluded;
       
   188      *          <code>EFalse</code> otherwise.
       
   189      */
       
   190     IMPORT_C TBool PlaceholderOnly() const;
       
   191 
       
   192     /** 
       
   193      * Sets whether the condition requires the object
       
   194      * to be a not placeholder object.
       
   195      *
       
   196      * @param aNotPlaceholder  <code>ETrue</code>, if the object should 
       
   197      *                                             be a not placeholder object.
       
   198      *                         <code>EFalse</code> otherwise.
       
   199      */
       
   200     IMPORT_C void SetPlaceholderOnly( TBool aPlaceholderOnly );
       
   201 
       
   202 private:
       
   203 
       
   204 	/**
       
   205 	 * Constructor.
       
   206 	 *
       
   207      * @param aCompareMethod  Comparison method.
       
   208      * @param aObjectId  ID number of an object.
       
   209 	 * @param aObjectDef     Object definition.
       
   210      * @param aObjectGuidHigh  object's GUID high part.
       
   211      * @param aObjectGuidLow   object's GUID low part.
       
   212 	 */
       
   213 	CMdEObjectCondition( TObjectConditionCompareMethod aCompareMethod,
       
   214 				TItemId aObjectId, const CMdEObjectDef* aObjectDef,
       
   215 				TInt64 aObjectGuidHigh, TInt64 aObjectGuidLow );
       
   216 
       
   217 	/**
       
   218 	 * Constructor.
       
   219 	 *
       
   220      * @param aCompareMethod  Comparison method.
       
   221 	 */
       
   222 	CMdEObjectCondition( TObjectConditionCompareMethod aCompareMethod );
       
   223 
       
   224     /**
       
   225      * Second-phase constructor.
       
   226      */
       
   227     void ConstructL();
       
   228 
       
   229     /**
       
   230      * Second-phase constructor.
       
   231      * 
       
   232      * @param aString         Text string to look for.
       
   233      * @param aObjectIds      object IDs to look for.
       
   234      */
       
   235     void ConstructL( const RArray<TItemId>* aObjectIds,
       
   236     		const TDesC* aString, const TMdEUintRange* aRange );
       
   237 
       
   238 private:
       
   239 
       
   240     /** Object definition to match. <code>NULL</code>, if not applicable. */
       
   241     const CMdEObjectDef* iObjectDef;
       
   242 
       
   243     /** The object's ID. */
       
   244     TItemId iObjectId;
       
   245 
       
   246     /** The objects' ID. */
       
   247     RArray<TItemId>* iObjectIds;
       
   248 
       
   249     /** String to match. <code>NULL</code>, if not applicable. */
       
   250     HBufC* iString;
       
   251 
       
   252     /** Compare method for the string. */
       
   253     TObjectConditionCompareMethod iCompareMethod;
       
   254 
       
   255     /** 
       
   256      * Object condition flags 
       
   257      * not present 
       
   258      * not placeholder
       
   259      */
       
   260     TUint32 iFlags;
       
   261 
       
   262     /** 
       
   263      * Determines confidentiality level of result object.
       
   264      * By default level is ELevelNormal, which means that
       
   265      * query returns only non-confidential objects as result.
       
   266      */
       
   267     TObjectConditionConfidentialityLevel iConfidentialityLevel;
       
   268 
       
   269     /** Object's GUID high part. */
       
   270     TInt64 iGuidHigh;
       
   271 
       
   272     /** Object's GUID low part. */
       
   273     TInt64 iGuidLow;
       
   274     
       
   275     TMdEUintRange* iRange;
       
   276     TBool iPlaceholdersOnly;
       
   277     };
       
   278 
       
   279 #endif  // __MDEOBJECTCONDITION_H__