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