ximpfw/core/srcdatamodel/ximpcontextclientinfoimp.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     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:  MXIMPContextClientInfo API object implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ximpcontextclientinfoimp.h"
       
    19 #include "ximpidentityimp.h"
       
    20 
       
    21 // ============================ MEMBER FUNCTIONS =============================
       
    22 
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CXIMPContextClientInfoImp::NewLC()
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C CXIMPContextClientInfoImp* CXIMPContextClientInfoImp::NewLC()
       
    29     {
       
    30     CXIMPContextClientInfoImp* self = new( ELeave ) CXIMPContextClientInfoImp;
       
    31     CleanupStack::PushL( self );
       
    32     self->ConstructL();
       
    33     return self;
       
    34     }
       
    35     
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CXIMPContextClientInfoImp::NewL()
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C CXIMPContextClientInfoImp* CXIMPContextClientInfoImp::NewL()
       
    42     {
       
    43     CXIMPContextClientInfoImp* self = NewLC();
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CXIMPContextClientInfoImp::NewFromStreamLC()
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( CXIMPContextClientInfoImp )
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // Implement supported interface access.
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPContextClientInfoImp, 
       
    60                                      MXIMPContextClientInfo )
       
    61 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
    62 
       
    63 
       
    64 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPContextClientInfoImp, 
       
    65                                            MXIMPContextClientInfo )
       
    66 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // CXIMPContextClientInfoImp::~CXIMPContextClientInfoImp()
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CXIMPContextClientInfoImp::~CXIMPContextClientInfoImp()
       
    73     {
       
    74     delete iClientId; 
       
    75     }
       
    76 
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CXIMPContextClientInfoImp::CXIMPContextClientInfoImp()
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 CXIMPContextClientInfoImp::CXIMPContextClientInfoImp()
       
    83     {
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CXIMPContextClientInfoImp::ConstructL()
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CXIMPContextClientInfoImp::ConstructL()
       
    91     {
       
    92     iClientId = CXIMPIdentityImp::NewL();
       
    93     }
       
    94 
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CXIMPContextClientInfoImp::ConstructL()
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CXIMPContextClientInfoImp::ConstructL( const TDesC16& aClientId )
       
   101     {
       
   102     iClientId = CXIMPIdentityImp::NewLC( aClientId );
       
   103     CleanupStack::Pop(); //iClientId
       
   104     }
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // CXIMPContextClientInfoImp::ExternalizeL()
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 void CXIMPContextClientInfoImp::ExternalizeL( RWriteStream& aStream ) const
       
   111     {
       
   112     iClientId->ExternalizeL( aStream );
       
   113     }
       
   114 
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CXIMPContextClientInfoImp::InternalizeL()
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C void CXIMPContextClientInfoImp::InternalizeL( RReadStream& aStream )
       
   121     {
       
   122     iClientId->InternalizeL( aStream );
       
   123     }
       
   124 
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CXIMPContextClientInfoImp::Match()
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 EXPORT_C TBool CXIMPContextClientInfoImp::Match( 
       
   131     const CXIMPContextClientInfoImp* aClientInfoImp ) const
       
   132     {
       
   133     return iClientId->Compare( *aClientInfoImp->iClientId ) == 0;
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // CXIMPContextClientInfoImp::EqualsContent()
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 TBool CXIMPContextClientInfoImp::EqualsContent( 
       
   141     const CXIMPApiDataObjBase& aOtherInstance ) const 
       
   142     {
       
   143     const CXIMPContextClientInfoImp* tmp =
       
   144     TXIMPGetImpClassOrPanic< const CXIMPContextClientInfoImp>::From( 
       
   145                                                        aOtherInstance.Base() );
       
   146 
       
   147     TBool same = Match( tmp ); 
       
   148     TBool x;
       
   149     x = ETrue; // do some comparison of member variable here
       
   150     same &= x;
       
   151     return same;
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // From MXIMPContextClientInfo class.
       
   156 // CXIMPContextClientInfoImp::ClientId()
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 const MXIMPIdentity& CXIMPContextClientInfoImp::ClientId() const
       
   160     {
       
   161     return *iClientId;
       
   162     }
       
   163 
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // From MXIMPContextClientInfo class.
       
   167 // CXIMPContextClientInfoImp::SetClientIdL()
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 void CXIMPContextClientInfoImp::SetClientIdL( 
       
   171     MXIMPIdentity* aIdentity )
       
   172     {   
       
   173     CXIMPIdentityImp* tmp =
       
   174     TXIMPGetImpClassOrPanic< CXIMPIdentityImp>::From( *aIdentity );
       
   175     
       
   176     delete iClientId;
       
   177     iClientId = tmp;
       
   178     }
       
   179 
       
   180     
       
   181 // End of file