imservices/imfeatureplugin/srcimdatamodel/imconversation/imconversationeventimp.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 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:  MImConversationEvent API object implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 #include "imconversationeventimp.h"
       
    19 #include "ximpapiobjbase.h"
       
    20 #include "ximpapieventbase.h"
       
    21 #include "imconversationinfoimp.h"
       
    22 #include <ximpbase.h>
       
    23 //#include "ximpobjecthelpers.h"
       
    24 // ---------------------------------------------------------------------------
       
    25 // CImConversationEventImp::NewLC()
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C CImConversationEventImp* CImConversationEventImp::NewLC(CImConversationInfoImp* aConvinfo)
       
    29     {
       
    30     CImConversationEventImp* self = new( ELeave ) CImConversationEventImp();
       
    31     CleanupStack::PushL( self );
       
    32     self->ConstructL( aConvinfo );
       
    33     return self;
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // CImConversationEventImp::NewFromStreamLC()
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CXIMPApiEventBase* CImConversationEventImp::NewFromStreamLC( RReadStream& aStream )
       
    41     {
       
    42     CImConversationEventImp* self = new( ELeave ) CImConversationEventImp;
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL( aStream );
       
    45     return self;
       
    46     }
       
    47 // ---------------------------------------------------------------------------
       
    48 // CImConversationEventImp::EqualsContent
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 TBool CImConversationEventImp::EqualsContent( 
       
    52     const CXIMPApiEventBase& /*aOtherInstance */) const 
       
    53     {
       
    54     return ETrue;
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // From class CXIMPApiEventBase
       
    59 // CImConversationEventImp::ExternalizeL
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CImConversationEventImp::ExternalizeL( RWriteStream& aStream ) const
       
    63     {
       
    64     iConvInfo->ExternalizeL( aStream );
       
    65     }
       
    66 
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CImConversationEventImp::~CImConversationEventImp()
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CImConversationEventImp::~CImConversationEventImp()
       
    73     {
       
    74    		delete iConvInfo;
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CImConversationEventImp::CImConversationEventImp()
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 CImConversationEventImp::CImConversationEventImp()
       
    83     {
       
    84     }
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CImConversationEventImp::ConstructL()
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CImConversationEventImp::ConstructL(CImConversationInfoImp* aConvinfo)
       
    92     {
       
    93     iConvInfo = aConvinfo; // ownership is transfered here, need to delete iConvInfo
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CImConversationEventImp::ConstructL()
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CImConversationEventImp::ConstructL( RReadStream& aStream )
       
   102     {
       
   103     iConvInfo=CImConversationInfoImp::NewL();
       
   104     iConvInfo->InternalizeL( aStream );
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // Implement supported interface access.
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CImConversationEventImp,
       
   112                                      MImConversationEvent )
       
   113     XIMPIMP_IF_BASE_GET_CLASS( CXIMPApiEventBase, this )
       
   114 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
   115 
       
   116 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CImConversationEventImp,
       
   117                                            MImConversationEvent )
       
   118     XIMPIMP_IF_BASE_GET_CONST_CLASS( CXIMPApiEventBase, this ) 
       
   119 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
   120 
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // Implement methods from base event interface and base event class
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 XIMPIMP_IMPLEMENT_EVENT_BASE_METHODS( CImConversationEventImp,
       
   128                                       MImConversationEvent )
       
   129 
       
   130 
       
   131 
       
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // CImConversationEventImp::InternalizeL( )
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 
       
   138 void CImConversationEventImp::InternalizeL(  RReadStream& aStream ) 
       
   139     { 
       
   140     iConvInfo->InternalizeL( aStream );     
       
   141     }
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // CImConversationEventImp::NewTextMessage()
       
   145 // ---------------------------------------------------------------------------
       
   146 //  	 
       
   147 const MImConversationInfo& CImConversationEventImp:: NewTextMessage( TInt /*aIndex*/ ) const 
       
   148 	{
       
   149 	return *iConvInfo;
       
   150 	}
       
   151     
       
   152 // ---------------------------------------------------------------------------
       
   153 // CImConversationEventImp::NewTextMessageCount()
       
   154 // ---------------------------------------------------------------------------
       
   155 //    
       
   156     
       
   157 TInt CImConversationEventImp::NewTextMessageCount() const
       
   158 	 {
       
   159 	 return 1;	// since the count is always 1 
       
   160 	 }
       
   161 // End of file
       
   162