ximpfw/presence/srcpresencedatamodel/presentitygroups/presentitygroupcontenteventimp.h
changeset 0 e6b17d312c8b
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     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:  MPresentityGroupContentEvent API object implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef CPRESENTITYGROUPCONTENTEVENTIMP_H
       
    19 #define CPRESENTITYGROUPCONTENTEVENTIMP_H
       
    20 
       
    21 
       
    22 #include "ximpapieventbase.h"
       
    23 #include "presencetypehelpers.h"
       
    24 #include "ximpdatasubscriptionstateimp.h"
       
    25 #include <presentitygroupcontentevent.h>
       
    26 
       
    27 
       
    28 class RReadStream;
       
    29 class CXIMPIdentityImp;
       
    30 class CPresentityGroupInfoImp;
       
    31 class CXIMPDataSubscriptionStateImp;
       
    32 
       
    33 /**
       
    34  * MOwnPresenceEvent API object implementation.
       
    35  *
       
    36  * @lib ximpdatamodel.dll
       
    37  * @since S60 v3.2
       
    38  */
       
    39 NONSHARABLE_CLASS( CPresentityGroupContentEventImp ): public CXIMPApiEventBase,
       
    40                                                        public MPresentityGroupContentEvent
       
    41     {
       
    42 public:
       
    43     /** The class ID. */
       
    44     enum { KClassId = PRIMP_CLSID_CPRESENTITYGROUPCONTENTEVENTIMP };
       
    45 
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Exported instantiation method for initializing
       
    50      * new event object.
       
    51      */
       
    52     IMPORT_C static CPresentityGroupContentEventImp* NewLC(
       
    53             CXIMPIdentityImp& aGroupId,
       
    54             RPrGrpMemInfoImpArray* aAdded,
       
    55             RPrGrpMemInfoImpArray* aUpdated,
       
    56             RPrGrpMemInfoImpArray* aRemoved,
       
    57             CXIMPDataSubscriptionStateImp* aState
       
    58             );
       
    59 
       
    60     IMPORT_C static CPresentityGroupContentEventImp* NewLC(
       
    61             CXIMPIdentityImp& aGroupId,
       
    62             RPrGrpMemInfoImpArray* aAdded,
       
    63             RPrGrpMemInfoImpArray* aUpdated,
       
    64             RPrGrpMemInfoImpArray* aRemoved,
       
    65             RPrGrpMemInfoImpArray* aCurrent,
       
    66             CXIMPDataSubscriptionStateImp* aState
       
    67             );
       
    68 
       
    69     IMPORT_C static CPresentityGroupContentEventImp* NewL(
       
    70             CXIMPIdentityImp& aGroupId,
       
    71             RPrGrpMemInfoImpArray* aAdded,
       
    72             RPrGrpMemInfoImpArray* aUpdated,
       
    73             RPrGrpMemInfoImpArray* aRemoved,
       
    74             RPrGrpMemInfoImpArray* aCurrent,
       
    75             CXIMPDataSubscriptionStateImp* aState
       
    76             );
       
    77 
       
    78     /**
       
    79      * Instantiation method for event automation.
       
    80      * Method signature must be exactly this to work
       
    81      * with event delivery automation system.
       
    82      *
       
    83      * Event implementation must be registered to
       
    84      * XIMPEventCodec KXIMPEventConstructorTable.
       
    85      */
       
    86     static CXIMPApiEventBase* NewFromStreamLC( RReadStream& aStream );
       
    87 
       
    88     virtual ~CPresentityGroupContentEventImp();
       
    89 
       
    90 
       
    91 private:
       
    92     CPresentityGroupContentEventImp();
       
    93 
       
    94     void ConstructL( CXIMPIdentityImp& aGroupId,
       
    95             RPrGrpMemInfoImpArray* aAdded,
       
    96             RPrGrpMemInfoImpArray* aUpdated,
       
    97             RPrGrpMemInfoImpArray* aRemoved,
       
    98             CXIMPDataSubscriptionStateImp* aState
       
    99             );
       
   100 
       
   101     void ConstructL( CXIMPIdentityImp& aGroupId,
       
   102             RPrGrpMemInfoImpArray* aAdded,
       
   103             RPrGrpMemInfoImpArray* aUpdated,
       
   104             RPrGrpMemInfoImpArray* aRemoved,
       
   105             RPrGrpMemInfoImpArray* aCurrent,
       
   106             CXIMPDataSubscriptionStateImp* aState );
       
   107 
       
   108     void ConstructL( RReadStream& aStream );
       
   109 
       
   110     /**
       
   111      * Helper for externalize.
       
   112      */
       
   113     void WriteArrayToStreamL( RPrGrpMemInfoImpArray& aArray,
       
   114             RWriteStream& aStream ) const;
       
   115 
       
   116     /**
       
   117      * Helper for internalize
       
   118      */
       
   119     void FillArrayFromStreamL( RPrGrpMemInfoImpArray& aArray,
       
   120             RReadStream& aStream );
       
   121 
       
   122 public: // From API base interfaces
       
   123 
       
   124     /**
       
   125      * Implementation of MXIMPBase interface methods
       
   126      * @see MXIMPBase
       
   127      */
       
   128     XIMPIMP_DECLARE_IF_BASE_METHODS
       
   129 
       
   130 
       
   131     /**
       
   132      * Implementation of MXIMPEventBase interface and
       
   133      * CXIMPApiEventBase methods
       
   134      *
       
   135      * @see MXIMPEventBase
       
   136      * @see CXIMPApiEventBase
       
   137      */
       
   138     XIMPIMP_DECLARE_EVENT_BASE_METHODS
       
   139 
       
   140 
       
   141 public: // From MPresentityGroupContentEvent
       
   142 
       
   143     const MXIMPIdentity& GroupId() const;
       
   144 
       
   145     TInt NewMembersCount() const;
       
   146     const MPresentityGroupMemberInfo& NewMember( TInt aIndex ) const;
       
   147 
       
   148     TInt UpdatedMembersCount() const;
       
   149     const MPresentityGroupMemberInfo& UpdatedMember( TInt aIndex ) const;
       
   150 
       
   151     TInt DisappearedMembersCount() const;
       
   152     const MPresentityGroupMemberInfo& DisappearedMember( TInt aIndex ) const;
       
   153 
       
   154     TInt CurrentMembersCount() const;
       
   155     const MPresentityGroupMemberInfo& CurrentMember( TInt aIndex ) const;
       
   156 
       
   157     const MXIMPDataSubscriptionState& DataSubscriptionState() const;
       
   158 
       
   159 private:
       
   160 
       
   161     /**
       
   162      * Compare the given arrays for equality.
       
   163      * Arrays must be sorted. This is a method specific
       
   164      * to the group info imp array.
       
   165      * @return ETrue if the arrays match, EFalse otherwise.
       
   166      */
       
   167     static TBool CompareArrays( RPrGrpMemInfoImpArray* aA, RPrGrpMemInfoImpArray* aB );
       
   168 
       
   169 private: // data
       
   170 
       
   171     /**
       
   172      * ETrue if constructed from stream.
       
   173      */
       
   174     TBool iConstructedFromStream;
       
   175 
       
   176     /**
       
   177      * Kludge to fix current members ownership issues.
       
   178      */
       
   179     TBool iOwnsCurrentMembersArray;
       
   180 
       
   181     /**
       
   182      * Group id
       
   183      *
       
   184      */
       
   185     CXIMPIdentityImp* iGroupId;
       
   186 
       
   187     /**
       
   188      * Group member informations.
       
   189      * Owns if constructed from stream. Otherwise does not own.
       
   190      * Might own current members in some cases, in which
       
   191      * iOwnsCurrentMembersArray
       
   192      * will be set.
       
   193      */
       
   194     RPrGrpMemInfoImpArray* iAddedMembers;
       
   195     RPrGrpMemInfoImpArray* iUpdatedMembers;
       
   196     RPrGrpMemInfoImpArray* iRemovedMembers;
       
   197     RPrGrpMemInfoImpArray* iCurrentMembers;
       
   198 
       
   199 
       
   200     /**
       
   201      *
       
   202      */
       
   203     CXIMPDataSubscriptionStateImp* iSubscriptionState;
       
   204     };
       
   205 
       
   206 
       
   207 #endif // CPRESENTITYGROUPCONTENTEVENTIMP_H