videocollection/mpxmyvideoscollection/tsrc/ut_vcxmyvideosmdsdb/inc/mdeorderrule.h
branchRCL_3
changeset 15 8f0df5c82986
equal deleted inserted replaced
14:55fa1ec415c6 15:8f0df5c82986
       
     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 __MDEORDERRULE_H__
       
    20 #define __MDEORDERRULE_H__
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <mdccommon.h>
       
    26 
       
    27 /* Forward declarations. */
       
    28 class CMdEPropertyDef;
       
    29 class CMdCSerializationBuffer;
       
    30 
       
    31 /**
       
    32  * TMdEOrderRule defines a rule that is used for sorting the results of a
       
    33  * query. A query may use multiple order rules.
       
    34  */
       
    35 class TMdEOrderRule
       
    36     {
       
    37 public:
       
    38 
       
    39     /* Constructors. */
       
    40 
       
    41     /**
       
    42      * Constructor.
       
    43      *
       
    44      * @param aType       Type of the order rule.
       
    45      * @param aAscending  <code>ETrue</code>, if the rule order is 
       
    46      *                    ascending.
       
    47      */        
       
    48     IMPORT_C TMdEOrderRule(TOrderRuleType aType, TBool aAscending = ETrue);   
       
    49 
       
    50     /**
       
    51      * Constructor.
       
    52      *
       
    53      * @param aPropertyDef  Property definition.
       
    54      * @param aAscending    <code>ETrue</code>, if the rule order is 
       
    55      *                      ascending.
       
    56      */        
       
    57     IMPORT_C TMdEOrderRule(const CMdEPropertyDef& aPropertyDef, 
       
    58                            TBool aAscending = ETrue);
       
    59 
       
    60 
       
    61     /* Methods. */
       
    62 
       
    63     /**
       
    64      * Returns the type of the order rule.
       
    65      *
       
    66      * @return  Order rule type constant.
       
    67      */
       
    68     IMPORT_C TOrderRuleType Type() const;
       
    69 
       
    70     /**
       
    71      * Sets the type of the order rule.
       
    72      *
       
    73      * @param aType  Order rule type constant.
       
    74      */
       
    75     IMPORT_C void SetType(TOrderRuleType aType);
       
    76 
       
    77     /**
       
    78      * Determines whether the ordering is ascending.
       
    79      *
       
    80      * @return  <code>ETrue</code> ascending order,
       
    81      *          <code>EFalse</code> descending order.
       
    82      */
       
    83     IMPORT_C TBool Ascending() const;
       
    84 
       
    85     /**
       
    86      * Sets the order rule to ascending or descending order.
       
    87      *
       
    88      * @param aAscending  <code>ETrue</code> ascending order,
       
    89      *                    <code>EFalse</code> descending order.
       
    90      */
       
    91     IMPORT_C void SetAscending(TBool aAscending = ETrue);
       
    92 
       
    93     /**
       
    94      * Returns the property definition associated with the order rule.
       
    95      *
       
    96      * @return  Property definition.  <code>NULL</code>, if no property
       
    97      *          definition has been associated with the rule.
       
    98      */
       
    99     IMPORT_C const CMdEPropertyDef* PropertyDef() const;
       
   100 
       
   101     /**
       
   102      * Associates a property definition with the order rule.
       
   103      *
       
   104      * @param aPropertyDef  Property definition.
       
   105      */
       
   106     IMPORT_C void SetPropertyDef(const CMdEPropertyDef& aPropertyDef);
       
   107 
       
   108     /**
       
   109      * Sets text sorting case sensitive or case insensitive.
       
   110      *
       
   111      * @param aCaseSensitive <code>ETrue</code> case sensitive sort.
       
   112                              <code>EFalse</code> case insensitive sort.
       
   113      */
       
   114     IMPORT_C void SetCaseSensitive(TBool aCaseSensitive);
       
   115 
       
   116     /**
       
   117      * Returns type of text comparison, whether case sensitive
       
   118      * or case insensitive.
       
   119      *
       
   120      * @return <code>ETrue</code> case sensitive sort.
       
   121      *         <code>EFalse</code> case insensitive sort.
       
   122      */
       
   123     IMPORT_C TBool CaseSensitive();
       
   124 
       
   125 	/**
       
   126      * Get required size of serialized buffer when this is serialized.
       
   127      *
       
   128      * @return required size of serialized buffer
       
   129      */
       
   130 	TUint32 RequiredBufferSize() const;
       
   131 
       
   132     /**
       
   133      * Serialize own data to serialized buffer (correct position must be set 
       
   134      * before calling) and return new position of serialized buffer.
       
   135 	 *
       
   136      * @param aBuffer  serialized buffer.
       
   137      */
       
   138     void SerializeL(CMdCSerializationBuffer& aBuffer, 
       
   139     		TMdCOffset& aFreespaceOffset) const;
       
   140 
       
   141 private:
       
   142 
       
   143     /** Type of the order rule. */
       
   144     TOrderRuleType iType;
       
   145     
       
   146     /** Optional. */
       
   147     const CMdEPropertyDef* iPropertyDef;
       
   148     
       
   149     /** Flag for ascending order. */
       
   150     TBool iAscending;
       
   151 
       
   152     /** Flag for text sorting. Default value is EFalse */
       
   153     TBool iCaseSensitive;
       
   154    };        
       
   155 
       
   156 #endif  // __MDEORDERRULE_H__