upnpharvester/common/cmlibrary/inc/cmrule.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2006-2007 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:      Capsulating Rules
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef __CMRULE_H
       
    24 #define __CMRULE_H
       
    25 
       
    26 // INCLUDES
       
    27 #include <e32base.h>
       
    28 #include "cmcommontypes.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class RWriteStream;
       
    32 class RReadStream;
       
    33 class CCmParam;
       
    34 
       
    35 /**
       
    36  *  CCmRule class
       
    37  *    Capsulating rules
       
    38  *  @lib cmcommon.lib
       
    39  *  @since S60 v3.0
       
    40  */
       
    41 NONSHARABLE_CLASS( CCmRule ) : public CBase
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /* Constructors and destructor. */
       
    47 
       
    48     /**
       
    49      * Creates new CCmRule class.
       
    50      * @param aDataField
       
    51      * @param aOperator
       
    52      * @return  pointer to CCmRule class
       
    53      */
       
    54     static CCmRule* NewL();
       
    55     
       
    56     /**
       
    57      * Creates new CCmRule class and 
       
    58      * leaves the instance in the cleanup stack.
       
    59      * @param aDataField
       
    60      * @param aOperator
       
    61      * @return  pointer to CCmRule class
       
    62      */
       
    63     static CCmRule* NewLC();
       
    64 
       
    65     /**
       
    66      * Destructor.
       
    67      */
       
    68     virtual ~CCmRule();
       
    69 
       
    70 public:
       
    71 
       
    72     /**
       
    73      * AddRuleParamL
       
    74      * @since Series 60 3.1     
       
    75      * @param aParam
       
    76      * @return  index of the param
       
    77      */
       
    78     TInt AddRuleParamL( const TDesC8& aParam );
       
    79 
       
    80     /**
       
    81      * AddRuleParamL ( indexed param )
       
    82      * @since Series 60 3.1     
       
    83      * @param aParam
       
    84      * @return  index of the param
       
    85      */
       
    86     TInt AddRuleParamL( TInt aParam );
       
    87     
       
    88     /**
       
    89      * Rule
       
    90      * @since Series 60 3.1          
       
    91      * @param aDataField, metadatafield on return
       
    92      * @param aOperator, operator on return
       
    93      * @param aParamCount, param count on return
       
    94      * @return None
       
    95      */    
       
    96     void Rule( TCmMetadataField* aDataField, TCmOperatorType* aOperator,
       
    97         TInt* aParamCount );
       
    98 
       
    99     /**
       
   100      * RuleParam
       
   101      * @since Series 60 3.1          
       
   102      * @param aParamIndex, parameter index
       
   103      * @param aParam, param
       
   104      * @return None
       
   105      */        
       
   106     void RuleParamL( TInt aParamIndex, TPtrC8* aParam );
       
   107     
       
   108     /**
       
   109      * RuleParam
       
   110      * @since Series 60 3.1          
       
   111      * @param aParamIndex, parameter index
       
   112      * @param aParam, param
       
   113      * @return None
       
   114      */        
       
   115     void RuleParamL( TInt aParamIndex, TInt& aParam );
       
   116     
       
   117     /**
       
   118      * SetMetadataField
       
   119      * @since Series 60 3.1          
       
   120      * @param aDataField, sets comparison field
       
   121      * @return None
       
   122      */        
       
   123     void SetMetadataField( TCmMetadataField aDataField );
       
   124 
       
   125     /**
       
   126      * SetOperator
       
   127      * @since Series 60 3.1          
       
   128      * @param aOperator, sets operator of the rule
       
   129      * @return None
       
   130      */            
       
   131     void SetOperator( TCmOperatorType aOperator );
       
   132         
       
   133     /**
       
   134      * RuleParamsCount
       
   135      * @since Series 60 3.1          
       
   136      * @return Count of rule params
       
   137      */    
       
   138     TInt RuleParamsCount() const;
       
   139     
       
   140     /**
       
   141     * Externalizes container information to stream.
       
   142     * Leaves in case of errors.
       
   143     * @since Series 60 3.1
       
   144     * @param reference to RWriteStream
       
   145     * @return none
       
   146     */
       
   147     void ExternalizeL( RWriteStream& aStream ) const;
       
   148     
       
   149     /**
       
   150     * Internalizes container information from stream.
       
   151     * Leaves in case of errors.
       
   152     * @since Series 60 3.1
       
   153     * @param reference to RReadStream
       
   154     * @return none
       
   155     */
       
   156     void InternalizeL( RReadStream& aStream );        
       
   157     
       
   158 private:
       
   159 
       
   160     /**
       
   161      * Constructor.
       
   162      */
       
   163     CCmRule();
       
   164 
       
   165     /**
       
   166      * Second-phase constructor.
       
   167      */
       
   168     void ConstructL();
       
   169     
       
   170 
       
   171 private: // data
       
   172     
       
   173     /** Metadata field */
       
   174     TCmMetadataField iMetadataField;
       
   175     
       
   176     /** Operator */
       
   177     TCmOperatorType iOperator;
       
   178     
       
   179     /** Array rules included to fill rule*/
       
   180     RPointerArray<CCmParam> iRuleParamsArray; // items owned
       
   181 
       
   182     };
       
   183     
       
   184 #endif //  __CMRULE_H