pushmtm/MtmUtilInc/PushInitiatorList.h
branchRCL_3
changeset 48 8e6fa1719340
parent 0 84ad3b177aa3
equal deleted inserted replaced
47:6385c4c93049 48:8e6fa1719340
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:  This header file contains the declaration of CPushInitiatorList.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef PUSHINITIATORLIST_H
       
    21 #define PUSHINITIATORLIST_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 
       
    25 #include "PushInitiator.h"
       
    26 #include <e32base.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 class CRepository;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * This class is used to store push initiator addresses.
       
    36 */
       
    37 class CPushInitiatorList : protected CArrayPtrFlat<CPushInitiator>
       
    38     {
       
    39     public: // Constructors and destructor
       
    40 
       
    41         /**
       
    42         * Two-phased constructor.
       
    43         * @return New CPushInitiatorList object.
       
    44         */
       
    45         IMPORT_C static CPushInitiatorList* NewL();
       
    46 
       
    47         /**
       
    48         * Destructor.
       
    49         */
       
    50         IMPORT_C ~CPushInitiatorList();
       
    51 
       
    52     public: // New functions
       
    53 
       
    54         /**
       
    55         * Append the initiator to the list. An Initiator is defined by an 
       
    56         * address and an address type together. 
       
    57         * The address with the given type is added to the list even if an 
       
    58         * initiator with the same address & type already exists in it.
       
    59         * @param aPushInitiator The push initiator.
       
    60         * @return A unique ID of the Initiator in the list (greater than 0).
       
    61         */
       
    62         IMPORT_C TUint32 AddL( const CPushInitiator& aPushInitiator );
       
    63 
       
    64         /**
       
    65         * Append the initiator to the list. An Initiator is defined by an 
       
    66         * address and an address type together. 
       
    67         * The address with the given type is added to the list even if an 
       
    68         * initiator with the same address & type already exists in it.
       
    69         * @param aPushInitiator The push initiator. Ownership is taken!
       
    70         * @return A unique ID of the Initiator in the list (greater than 0).
       
    71         */
       
    72         IMPORT_C TUint32 AddL( CPushInitiator* aPushInitiator );
       
    73 
       
    74         /**
       
    75         * Give a reference to the indicated initiator.
       
    76         * @param aIndex Index of the initiator starting from zero.
       
    77         * @return Reference to the initiator.
       
    78         */
       
    79         IMPORT_C CPushInitiator& At( TInt aIndex ) const;
       
    80 
       
    81         /**
       
    82         * Delete the initiator at index.
       
    83         * @param aIndex Index of the initiator starting from zero.
       
    84         * @return None.
       
    85         */
       
    86         IMPORT_C void Delete( TInt aIndex );
       
    87 
       
    88         /**
       
    89         * Number of initiators in the list.
       
    90         * @return Item count.
       
    91         */
       
    92         IMPORT_C TInt Count() const;
       
    93 
       
    94         /**
       
    95         * Get a free ID that is not used by the list members yet. 
       
    96         * The smallest ID got is 1.
       
    97         * See CPushInitiator::EntryID()!
       
    98         * @return The largest ID used plus 1 is returned.
       
    99         */
       
   100         TUint32 FreeId() const;
       
   101 
       
   102         /**
       
   103         * Return the "changed" flag.
       
   104         * @return See above.
       
   105         */
       
   106         TBool Changed() const;
       
   107 
       
   108         /**
       
   109         * Reset the "changed" flag.
       
   110         * @return None.
       
   111         */
       
   112         void ResetChanged();
       
   113 
       
   114         /**
       
   115         * Delete the items in the list.
       
   116         * @return None.
       
   117         */
       
   118         IMPORT_C void ResetAndDestroy();
       
   119 
       
   120         /**
       
   121         * Find the first occurrence of the given initiator in the list. 
       
   122         * This method uses only the address & type properties of the 
       
   123         * Initiator - it does not use the ID property!
       
   124         * @param aPushInitiator The push initiator to be found.
       
   125         * @param aIndex If found, the index of it starting from zero.
       
   126         * @return KErrNone if found, KErrNotFound otherwise.
       
   127         */
       
   128         IMPORT_C TInt Find( const CPushInitiator& aPushInitiator, 
       
   129                             TInt& aIndex ) const;
       
   130 
       
   131         IMPORT_C TBool operator==( const CPushInitiatorList& aList ) const;
       
   132         IMPORT_C TBool operator!=( const CPushInitiatorList& aList ) const;
       
   133 
       
   134         /**
       
   135         * Externalize into the Repository.
       
   136         * @param aRepository CenRep
       
   137         * @return none
       
   138         */
       
   139         void ExternalizeL( CRepository& aRepository ) const;
       
   140 
       
   141         /**
       
   142         * Internalize from the Repository.
       
   143         * @param aRepository CenRep
       
   144         * @return none
       
   145         */
       
   146         void InternalizeL( CRepository& aRepository );
       
   147 
       
   148         void ParseAndProcessBuf2ListL( const TDesC& aStreamedBuf );
       
   149                          
       
   150         HBufC* ParseAndProcessList2BufL() const;
       
   151                          
       
   152     private: // Constructors and operators
       
   153 
       
   154         CPushInitiatorList( const TInt aGranularity );
       
   155 
       
   156     private: // Data
       
   157 
       
   158         /// The following members indicate if a value has been changed.
       
   159         TBool iPushInitiatorListChanged;
       
   160     };
       
   161 
       
   162 #endif // PUSHINITIATORLIST_H
       
   163 
       
   164 // End of File