pressrv_plat/authorization_api/inc/prescondidentitymany.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 the 'many' element
       
    15 *                 part of the Presence Condition
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __PRESCONDIDENTITYMANY_H__
       
    22 #define __PRESCONDIDENTITYMANY_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 *  TPresCondIdentityMany is used to manipulate the 'many' element part of a 
       
    40 *  Condition 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 TPresCondIdentityMany
       
    46     {
       
    47     public:
       
    48     
       
    49         /**
       
    50         * C++ Constructor, After contructing Init must be called before using
       
    51         * this object.
       
    52         */                                        
       
    53         IMPORT_C TPresCondIdentityMany();
       
    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         * Puts the 'many' element in identity, with domain name
       
    66         *
       
    67         * @param TDesC& aRuleID rule ID
       
    68         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
    69         * @return KErrNotFound if rule not found, KErrAlreadyExists
       
    70         */
       
    71         IMPORT_C TInt AddManyIdentityL(const TDesC& aRuleID, 
       
    72                                                 const TDesC& aDomain);
       
    73         
       
    74         /**
       
    75         * Finds whether 'many' element exists in identities or not, with 
       
    76         * optional domain name
       
    77         *
       
    78         * @param TDesC& aRuleID rule ID
       
    79         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
    80         * @return ETrue if exists
       
    81         */
       
    82         IMPORT_C TBool IsManyExistsL(const TDesC& aRuleID, 
       
    83                                             const TDesC& aDomain);
       
    84         
       
    85         /**
       
    86         * Removes the 'many' element from identity, optional domain name
       
    87         *
       
    88         * @param TDesC& aRuleID rule ID
       
    89         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
    90         * @return KErrNotFound if rule or many element not found
       
    91         */
       
    92         IMPORT_C TInt RemoveManyIdentityL(const TDesC& aRuleID, 
       
    93                                             const TDesC& aDomain);
       
    94                                             
       
    95         /**
       
    96         * Get the number of 'many' elements in identity node, those elements
       
    97         * which has domain name are returned in aDomains array
       
    98         *
       
    99         * @param TDesC& aRuleID rule ID
       
   100         * @param CDesCArray& aDomains domain names if exists
       
   101         * @return TInt number of total many elements.
       
   102         */
       
   103         IMPORT_C TInt GetManyIdentityElementsL(const TDesC& aRuleID, 
       
   104                                                     CDesCArray& aDomains);
       
   105         
       
   106         /**
       
   107         * Add identity to 'except' child of many element
       
   108         *
       
   109         * @param TDesC& aRuleID rule ID
       
   110         * @param TDesC& aEntity to be added
       
   111         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
   112         * @return KErrNotFound if rule or many element not found
       
   113         */
       
   114         IMPORT_C TInt AddIdentityInManyExceptL(const TDesC& aRuleID,
       
   115                     const TDesC& aEntity, const TDesC& aDomain);
       
   116                     
       
   117         /**
       
   118         * Add identities to 'except' child of many element
       
   119         *
       
   120         * @param TDesC& aRuleID rule ID
       
   121         * @param CDesCArray& aEntities to be added
       
   122         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
   123         * @return KErrNotFound if rule or many element not found
       
   124         */
       
   125         IMPORT_C TInt AddIdentitiesInManyExceptL(const TDesC& aRuleID,
       
   126                 const CDesCArray& aEntities, const TDesC& aDomain);
       
   127                                         
       
   128         /**
       
   129         * Get identities from 'except' child of many element
       
   130         *
       
   131         * @param TDesC& aRuleID rule ID
       
   132         * @param CDesCArray& aEntities fethed identities
       
   133         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
   134         * @return KErrNotFound if rule or many element not found
       
   135         */
       
   136         IMPORT_C TInt GetIdentitiesFromManyExceptL(const TDesC& aRuleID,
       
   137                     CDesCArray& aEntities, const TDesC& aDomain);
       
   138                     
       
   139         /**
       
   140         * Removes an identity from 'except' child of many element
       
   141         *
       
   142         * @param TDesC& aRuleID rule ID
       
   143         * @param TDesC& aEntity to be deleted
       
   144         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
   145         * @return KErrNotFound if rule or many element or id not found
       
   146         */
       
   147         IMPORT_C TInt RemoveIdentityFromManyExceptL(const TDesC& aRuleID,
       
   148                         const TDesC& aEntity, const TDesC& aDomain);
       
   149                                         
       
   150         /**
       
   151         * Deletes all identities in the 'except' child of 'many'
       
   152         *
       
   153         * @param TDesC& aRuleID rule ID
       
   154         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
   155         * @return KErrNotFound if rule or many element not found
       
   156         */
       
   157         IMPORT_C TInt DeleteAllIdentitiesFromManyExceptL(const TDesC& aRuleID,
       
   158                                                const TDesC& aDomain);
       
   159                                                
       
   160         /**
       
   161         * Is identity exists in the 'except' child of many element
       
   162         *
       
   163         * @param TDesC& aRuleID rule ID
       
   164         * @param TDesC& aEntity to be searched
       
   165         * @param TDesC& aDomain domain name, provide KNullDesC if not needed
       
   166         * @return ETrue if exists
       
   167         */
       
   168         IMPORT_C TBool IsIdentityExistsInManyExceptL(const TDesC& aRuleID, 
       
   169                                         const TDesC& aEntity, 
       
   170                                         const TDesC& aDomain);
       
   171 
       
   172     private:
       
   173     
       
   174         /**
       
   175         * Gets the 'many' node pointer in a rule
       
   176         *
       
   177         * @param TDesC& aRuleID rule ID.
       
   178         * @param TBool aCreate if ETrue, creates many node if not exist
       
   179         * @param TDesC& aDomain, domain name, can be KNullDesC
       
   180         * @return CXdmDocumentNode* pointer to 'many' node or NULL
       
   181         */
       
   182         CXdmDocumentNode* GetManyNodeL(const TDesC& aRuleID,  
       
   183                                     TBool aCreate, const TDesC& aDomain);
       
   184                                                             
       
   185         /**
       
   186         * Finds whether the given entity exists in the node array
       
   187         *
       
   188         * @param RPointerArray<CXdmDocumentNode>& nodes array of nodes
       
   189         * @param TDesC& aEntity to find
       
   190         * @return ETrue of exists
       
   191         */
       
   192         TBool IsEntityExistInNodeArray(const RPointerArray<CXdmDocumentNode>& nodes, 
       
   193                                                     const TDesC& aEntity);
       
   194 
       
   195     private: // data
       
   196         
       
   197         // Pointer to CPresenceXDM - not owned
       
   198         CPresenceXDM*           iPresXDM;      // not owned
       
   199         
       
   200     };
       
   201     
       
   202    
       
   203 #endif //__PRESCONDIDENTITYMANY_H__
       
   204