mds_plat/metadata_engine_api/inc/mdccommon.h
changeset 60 79f826a55db2
equal deleted inserted replaced
58:fe894bb075c2 60:79f826a55db2
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Common message definitions and utilities
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MDCCOMMON_H__
       
    19 #define __MDCCOMMON_H__
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32base.h>
       
    23 #include <mdeerror.h>
       
    24 
       
    25 // MDS version
       
    26 #define MDS_VERSION_2_5
       
    27 
       
    28 // Item id
       
    29 typedef TUint32 TItemId;
       
    30 typedef TUint32 TDefId;
       
    31 typedef TUint32 TMdCOffset;
       
    32 
       
    33 const TItemId KNoId = 0;
       
    34 const TItemId KSystemCapturedAlbumId = 2;
       
    35 const TDefId KNoDefId = 0;
       
    36 
       
    37 // CONSTANTS
       
    38 _LIT( KMdEDefaultNameSpace, "http://sw.nokia.com/MdE" );
       
    39 
       
    40 // Type of property
       
    41 enum TPropertyType
       
    42     {
       
    43     EPropertyBool   = 0,
       
    44     EPropertyInt8   = 1,
       
    45     EPropertyUint8  = 2,
       
    46     EPropertyInt16  = 3,
       
    47     EPropertyUint16 = 4,
       
    48     EPropertyInt32  = 5,
       
    49     EPropertyUint32 = 6,
       
    50     EPropertyInt64  = 7,
       
    51     EPropertyReal32 = 8,
       
    52     EPropertyReal64 = 9,
       
    53     EPropertyTime   = 10,
       
    54     EPropertyText   = 11,
       
    55     };
       
    56 
       
    57 /**
       
    58  * Query types.
       
    59  */
       
    60 enum TQueryType
       
    61     {
       
    62     EQueryTypeFirst = 0,    // must always be the first one
       
    63 
       
    64     /** Query that returns CMdEObject items, IDs, count or distinct property values. */
       
    65     EQueryTypeObject,
       
    66 
       
    67     /** Query that returns CMdERelation items, IDs or count. */
       
    68     EQueryTypeRelation,
       
    69 
       
    70     /** Query that returns CMdEEvent items, IDs or count. */
       
    71     EQueryTypeEvent,
       
    72 
       
    73     EQueryTypeLast   // must always be the last one
       
    74     };  
       
    75 
       
    76 /** 
       
    77  * Query's result type.
       
    78  */
       
    79 enum TQueryResultMode
       
    80     {
       
    81     EQueryResultModeFirst = 0, // must always be the first one
       
    82 
       
    83     /** Query returns whole items (objects are returned without freetexts). */
       
    84     EQueryResultModeItem,
       
    85 
       
    86     /** Query returns set of IDs. */
       
    87     EQueryResultModeId,
       
    88 
       
    89     /** Query returns count of items */
       
    90     EQueryResultModeCount,
       
    91 
       
    92 	/** Query returns distinct values from specified property definition. 
       
    93 	 *  Query's type must be EQueryTypeObject. */
       
    94     EQueryResultModeDistinctValues,
       
    95 
       
    96 	/** Query returns whole items with freetexts. */
       
    97 	EQueryResultModeObjectWithFreetexts,
       
    98 
       
    99     EQueryResultModeLast // must always be the last one
       
   100     };
       
   101 
       
   102 /** Types of sort order. */
       
   103 enum TMdESortOrder
       
   104 	{
       
   105 	ESortAscending = ETrue, 
       
   106 	ESortDescending = EFalse
       
   107 	};
       
   108 
       
   109 /** Types of result ordering rules. */
       
   110 enum TOrderRuleType
       
   111     {
       
   112     EOrderRuleTypeFirst = 0,
       
   113 
       
   114     /** Sort results with item ID. */
       
   115     EOrderRuleTypeItemID,
       
   116 
       
   117     /** Sort results by object URI. */
       
   118     EOrderRuleTypeObjectURI,
       
   119 
       
   120     /** Sort results by object definition. */
       
   121     EOrderRuleTypeObjectDef,
       
   122 
       
   123     /** Sort results by the value of a property. */
       
   124     EOrderRuleTypeProperty,
       
   125 
       
   126     /** Sort objects by usage count. */
       
   127     EOrderRuleTypeUsageCount,
       
   128 
       
   129     /** Sort events by creation time. */
       
   130     EOrderRuleTypeCreationTime,
       
   131 
       
   132     /** Sort events by source URI. */
       
   133     EOrderRuleTypeSourceURI,
       
   134 
       
   135     /** Sort events by participant URI. */
       
   136     EOrderRuleTypeParticipantURI,
       
   137 
       
   138     /** Sort events by target object's ID. */
       
   139     EOrderRuleTypeTargetObjectID,
       
   140 
       
   141     /** Sort events by event definition. */
       
   142     EOrderRuleTypeEventDef,
       
   143 
       
   144     /** Sort relations by last modified date. */
       
   145     EOrderRuleTypeLastModifiedDate,
       
   146 
       
   147     /** Sort relations by parameter. */
       
   148     EOrderRuleTypeParameterValue,
       
   149 
       
   150     /** Sort relations by left object's ID. */
       
   151     EOrderRuleTypeLeftObjectID,
       
   152 
       
   153     /** Sort relations by right object's ID. */
       
   154     EOrderRuleTypeRightObjectID,
       
   155 
       
   156     /** Sort relations by relation definition. */
       
   157     EOrderRuleTypeRelationDef,
       
   158             
       
   159     EOrderRuleTypeLast
       
   160     };
       
   161 
       
   162 
       
   163 /**
       
   164  * Condition types.
       
   165  */
       
   166 enum TConditionType
       
   167 	{
       
   168 	EConditionTypeFirst	= 0x0000,   // must always be the first one
       
   169     
       
   170     /** logic conditions combine other conditions with logic operators */
       
   171     EConditionTypeLogic,
       
   172 
       
   173     /** conditions for object ID, URI, definition */
       
   174     EConditionTypeObject,            
       
   175 
       
   176     /** conditions for the property definition */
       
   177     EConditionTypeProperty,          
       
   178     
       
   179     /** condition for the value of a int property */
       
   180     EConditionTypePropertyIntRange,  
       
   181     
       
   182     /** condition for the value of a int64 property */
       
   183     EConditionTypePropertyInt64Range,
       
   184 
       
   185     /** condition for the value of a uint property */
       
   186     EConditionTypePropertyUintRange,  
       
   187 
       
   188     /** condition for the value of a real property */
       
   189     EConditionTypePropertyRealRange, 
       
   190 
       
   191     /** condition for the value of a time property */
       
   192     EConditionTypePropertyTimeRange, 
       
   193 
       
   194     /** condition for the value of a string property */
       
   195     EConditionTypePropertyText,    
       
   196 
       
   197     /** condition for the value of a boolean property */
       
   198     EConditionTypePropertyBool,      
       
   199 
       
   200     /** conditions for relation items */
       
   201     EConditionTypeRelation,          
       
   202 
       
   203     /** conditions for an event */
       
   204     EConditionTypeEvent,             
       
   205 
       
   206 	EConditionTypeLast				// must always be the last one
       
   207 	};
       
   208 
       
   209 /**
       
   210  * Observer notification types
       
   211  */
       
   212 enum TObserverNotificationType
       
   213 	{
       
   214 	ENotifyAdd    = 0x0001,
       
   215 	ENotifyModify = 0x0002,
       
   216 	ENotifyRemove = 0x0004,
       
   217 	};
       
   218 
       
   219 /** Logic condition operators. */
       
   220 enum TLogicConditionOperator
       
   221     {
       
   222     ELogicConditionOperatorFirst = 0x0000,
       
   223 
       
   224     /** Boolean AND operator. */
       
   225     ELogicConditionOperatorAnd,
       
   226 
       
   227     /** Boolean OR operator. */
       
   228     ELogicConditionOperatorOr,
       
   229 
       
   230     ELogicConditionOperatorLast
       
   231     };
       
   232 
       
   233 /** Methods of comparing object data. */
       
   234 enum TObjectConditionCompareMethod 
       
   235     {
       
   236     EObjectConditionCompareFirst = 0,
       
   237 
       
   238     /** NONE. Just for sending condition flags */
       
   239     EObjectConditionCompareNone,
       
   240 
       
   241     /** Object ID. */
       
   242     EObjectConditionCompareId,
       
   243 
       
   244     /** Object IDs. */
       
   245     EObjectConditionCompareIds,
       
   246 
       
   247 	/** Object GUID. */
       
   248 	EObjectConditionCompareGuid,
       
   249 
       
   250     /** Object definition. */
       
   251     EObjectConditionCompareObjectDef,
       
   252 
       
   253     /** Object URI. */
       
   254     EObjectConditionCompareUri,
       
   255 
       
   256 	/** Object URI begins with specified string. */
       
   257     EObjectConditionCompareUriBeginsWith,
       
   258     
       
   259     /** Free text keyword associated with the object must be an 
       
   260         exact match. */
       
   261     EObjectConditionCompareFreeText,
       
   262 
       
   263     /** Free text keyword associated with the object contains 
       
   264         specified string. */
       
   265     EObjectConditionCompareFreeTextContains,
       
   266 
       
   267     /** Free text keyword associated with the object begins with 
       
   268         specified string. */
       
   269     EObjectConditionCompareFreeTextBeginsWith,
       
   270 
       
   271     /** Free text keyword associated with the object ends with 
       
   272         specified string. */
       
   273     EObjectConditionCompareFreeTextEndsWith,
       
   274 
       
   275     /** Usage count */
       
   276     EObjectConditionCompareUsageCount,
       
   277     
       
   278     /** Object URIcontains specified string. */
       
   279     EObjectConditionCompareUriContains,
       
   280 
       
   281     EObjectConditionCompareLast
       
   282     };
       
   283 
       
   284 /** Methods of filtering confidential and non-confidential objects. */
       
   285 enum TObjectConditionConfidentialityLevel
       
   286     {
       
   287     EObjectConditionLevelFirst = 0,
       
   288 
       
   289     /** Both confidential and non-confidential objects */
       
   290     EObjectConditionLevelIgnoreConfidentiality,
       
   291 
       
   292     /** Selects ONLY non-confidential objects */
       
   293     EObjectConditionLevelNormal,
       
   294 
       
   295     /** Selects ONLY confidential objects. */
       
   296     EObjectConditionLevelConfidential,
       
   297 
       
   298     EObjectConditionLevelLast
       
   299     };
       
   300 
       
   301 /** Methods of comparing event data. */
       
   302 enum TEventConditionCompareMethod 
       
   303     {
       
   304     EEventConditionCompareFirst = 0x0000,
       
   305     
       
   306     /** No comparison specified. */
       
   307     EEventConditionCompareNone,
       
   308     
       
   309     /** Specified string must match the source URI. */
       
   310     EEventConditionCompareSourceURI,
       
   311     
       
   312     /** Specified string must match the participant URI. */
       
   313     EEventConditionCompareParticipantURI,
       
   314     
       
   315     /**Specified id must match events id*/
       
   316     EEventConditionCompareId,
       
   317 
       
   318     //ECompareSourceURIBeginsWith,
       
   319     //ECompareParticipantRIBeginsWith,
       
   320     
       
   321     EEventConditionCompareLast
       
   322     };
       
   323 
       
   324 /** Side on which the relation must be in relation to a matched object. */
       
   325 enum TRelationConditionSide
       
   326     {
       
   327     /** Object must be on either the left or the right side of 
       
   328         the relation. */
       
   329     ERelationConditionSideEither,
       
   330 
       
   331     /** Object must be on the left side of the relation. */
       
   332     ERelationConditionSideLeft,
       
   333 
       
   334     /** Object must be on the right side of the relation. */
       
   335     ERelationConditionSideRight
       
   336     };
       
   337 
       
   338 /** Text value comparison methods. */
       
   339 enum TTextPropertyConditionCompareMethod
       
   340     {
       
   341     ETextPropertyConditionCompareFirst = 0x0000,
       
   342     ETextPropertyConditionCompareEquals,          // LIKE "str"
       
   343     ETextPropertyConditionCompareContains,        // LIKE "%str%"
       
   344     ETextPropertyConditionCompareBeginsWith,      // LIKE "str%"
       
   345     ETextPropertyConditionCompareEndsWith,        // LIKE "%str"
       
   346     ETextPropertyConditionCompareLast
       
   347     };
       
   348 
       
   349 
       
   350 /**
       
   351  * Min and max value
       
   352  * There are used like:
       
   353  * for Real types:   iMinValue.iReal, iMaxValue.iReal
       
   354  * for Int64 types:  iMinValue.iInt64, iMaxValue.iInt64
       
   355  * for Uint32 types: iMinValue.iUint32, iMaxValue.iUint32
       
   356  * (!!) others:      iMinValue.iInt32, iMaxValue.iInt32
       
   357  */
       
   358 union TMdCValueUnion 
       
   359 	{
       
   360 	TInt32   iInt32;
       
   361 	TUint32  iUint32;
       
   362 	TInt64   iInt64;
       
   363 	TReal64  iReal;
       
   364 	HBufC16* iText;
       
   365 
       
   366 	struct
       
   367 		{
       
   368 		TUint32 iCount;
       
   369 		TMdCOffset iOffset;
       
   370 		} iPtr;
       
   371 	};
       
   372 
       
   373 /**
       
   374 * Common utilities.
       
   375 * Used as a static function library -
       
   376 * This class is not to be instantiated.
       
   377 */
       
   378 class MMdCCommon
       
   379     {
       
   380     public: // public definitions
       
   381         /** Creates a panic */
       
   382         IMPORT_C static void Panic( TInt aPanicCode );
       
   383     };
       
   384         
       
   385 #endif // __MDCCOMMON_H__