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