pressrv_plat/authorization_api/inc/prescondidentityone.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2006 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:    RLS and Presence XDM, This class represents 'one' identity part
       
    15 *                 of a Presence Condition in a rule
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __PRESCONDIDENTITYONE_H__
       
    22 #define __PRESCONDIDENTITYONE_H__
       
    23 
       
    24 // Includes
       
    25 #include <e32std.h>
       
    26 #include <e32base.h>
       
    27 #include <badesca.h>
       
    28 #include <rlspresxdmconsts.h>
       
    29 
       
    30 // Forward declarations
       
    31 class CPresenceXDM;
       
    32 class CXdmDocumentNode;
       
    33 
       
    34 // Class declaration
       
    35 /** 
       
    36 * This class should be used in conjunction with an already created CPresenceXDM.
       
    37 *  The CPresenceXDM deals with the Presence rules as a whole and has communication
       
    38 *  with the server.
       
    39 *  TPresCondIdentityOne is used to manipulate the 'one' identity part of a Condition
       
    40 *  in a rule. Remember to call Init function after constructing this object.
       
    41 *  
       
    42 *  @lib rlspresxdm.lib
       
    43 *  @since S60 3.2
       
    44 */
       
    45 class TPresCondIdentityOne
       
    46     {
       
    47     public:
       
    48     
       
    49         /**
       
    50         * C++ Constructor, After contructing Init must be called before using
       
    51         * this object.
       
    52         */                                        
       
    53         IMPORT_C TPresCondIdentityOne();
       
    54         
       
    55         /**
       
    56         * Initializes the object with the given pointer to CPresenceXDM.
       
    57         * This function must be called before using other functions.
       
    58         *
       
    59         * @param CPresenceXDM* pointer to created CPresenceXDM
       
    60         */
       
    61         IMPORT_C void Init(CPresenceXDM* const aPresXDM);
       
    62         
       
    63                                                 
       
    64         /**
       
    65         * Adds condition identities to a rule. This functions doesnt give
       
    66         * error if any or all ids already exists, nor it overwrites them.
       
    67         *
       
    68         * @param TDesC& aRuleID rule ID  
       
    69         * @param aIds It contains array of ids.
       
    70         * @return TInt KErrNone, KErrNotFound if rule doesnt found
       
    71         */
       
    72         IMPORT_C TInt AddIdentitiesL(const TDesC& aRuleID,
       
    73                                                 const MDesCArray& aIds);
       
    74 
       
    75         /**
       
    76         * Gets condition identities from a rule
       
    77         *
       
    78         * @param TDesC& aRuleID rule ID 
       
    79         * @param aIds contains returned array of ids.
       
    80         */
       
    81         IMPORT_C void GetIdentitiesL(const TDesC& aRuleID, 
       
    82                                                     CDesCArray& aIds);
       
    83                                                     
       
    84         /**
       
    85         * Deletes specific condition identities if they found.
       
    86         *
       
    87         * @param TDesC& aRuleID rule ID 
       
    88         * @param aIds contains array of ids to be deleted.
       
    89         */
       
    90         IMPORT_C void DeleteIdentitiesL(const TDesC& aRuleID,
       
    91                                                 const MDesCArray& aIds);
       
    92                                                     
       
    93         /**
       
    94         * Deletes all conditions identities from a rule if found
       
    95         *
       
    96         * @param TDesC& aRuleID rule ID
       
    97         */
       
    98         IMPORT_C void DeleteAllIdentitiesL(const TDesC& aRuleID);
       
    99 
       
   100         /**
       
   101         * Adds a condition identity to a rule
       
   102         *
       
   103         * @param TDesC& aRuleID rule ID
       
   104         * @param aId an identity to be added
       
   105         * @return TInt KErrNone, KErrNotFound if rule doesnt found or
       
   106         *   KErrAlreadyExists in case already exists
       
   107         */
       
   108         IMPORT_C TInt AddIdentityL(const TDesC& aRuleID, 
       
   109                                                         const TDesC& aId);
       
   110                                                         
       
   111         /**
       
   112         * Deletes an identity from a condition
       
   113         *
       
   114         * @param TDesC& aRuleID rule ID 
       
   115         * @param TDesC& aId an identity to be removed
       
   116         * @return KErrNotFound if not found.
       
   117         */
       
   118         IMPORT_C TInt DeleteIdentityL(const TDesC& aRuleID, 
       
   119                                                         const TDesC& aId);
       
   120                                                         
       
   121         /**
       
   122         * Finds if a identity exist in a rule
       
   123         *
       
   124         * @param TDesC& aRuleID rule ID
       
   125         * @param TDesC& aId to be searched
       
   126         * @return TBool ETrue if entry found
       
   127         */
       
   128         IMPORT_C TBool IsIdentityExistL(const TDesC& aRuleID, 
       
   129                                                     const TDesC& aId);
       
   130                                                 
       
   131     private:
       
   132     
       
   133         /**
       
   134         * Finds whether the given id exists in the node array
       
   135         *
       
   136         * @param RPointerArray<CXdmDocumentNode>& nodes array of nodes
       
   137         * @param TDesC& aId to find
       
   138         * @return ETrue of exists
       
   139         */
       
   140         TBool IsIdExistInNodeArray(const RPointerArray<CXdmDocumentNode>& nodes, 
       
   141                                                     const TDesC& aId);
       
   142 
       
   143     private: // data
       
   144         
       
   145         // Pointer to CPresenceXDM - not owned
       
   146         CPresenceXDM*           iPresXDM;      // not owned
       
   147         
       
   148     };
       
   149     
       
   150    
       
   151 #endif //__PRESCONDIDENTITYONE_H__