emailservices/emailclientapi/src/emailaddress.cpp
branchRCL_3
changeset 24 d189ee25cf9d
parent 8 e1b6206813b4
child 25 3533d4323edc
equal deleted inserted replaced
23:dcf0eedfc1a3 24:d189ee25cf9d
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 * Description: This file implements class CEmailAddress.
    14 * Description: This file implements class CEmailAddress.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "emailaddress.h"
    18 #include "emailaddress.h"
    19 #include "cfsmailclient.h"
    19 #include "CFSMailClient.h"
    20 #include "emailclientapi.hrh"
    20 #include "emailclientapi.hrh"
    21 
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // 
       
    24 // -----------------------------------------------------------------------------
    22 CEmailAddress* CEmailAddress::NewL( const TRole aRole, const TDataOwner aOwner )
    25 CEmailAddress* CEmailAddress::NewL( const TRole aRole, const TDataOwner aOwner )
    23     {
    26     {
    24     CEmailAddress* self = new ( ELeave ) CEmailAddress( aRole, aOwner );
    27     CEmailAddress* self = new ( ELeave ) CEmailAddress( aRole, aOwner );
    25     
    28 
    26     return self;
    29     return self;
    27     }
    30     }
    28 
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // 
       
    34 // -----------------------------------------------------------------------------
    29 CEmailAddress* CEmailAddress::NewLC( const TRole aRole, const TDataOwner aOwner )
    35 CEmailAddress* CEmailAddress::NewLC( const TRole aRole, const TDataOwner aOwner )
    30     {
    36     {
    31     CEmailAddress* self = CEmailAddress::NewL( aRole, aOwner );
    37     CEmailAddress* self = CEmailAddress::NewL( aRole, aOwner );
    32     CleanupStack::PushL( self );
    38     CleanupStack::PushL( self );
    33     return self;
    39     return self;
    34     }
    40     }
    35 
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // 
       
    44 // -----------------------------------------------------------------------------
    36 CEmailAddress::~CEmailAddress()
    45 CEmailAddress::~CEmailAddress()
    37     {
    46     {
    38     iAddress.Close();
    47     iAddress.Close();
    39     iDisplayName.Close();
    48     iDisplayName.Close();
    40     }
    49     }
    41 
    50 
    42 CEmailAddress::CEmailAddress( const TRole aRole, const TDataOwner aOwner ) : iRole( aRole ), iOwner( aOwner )
    51 // -----------------------------------------------------------------------------
       
    52 // 
       
    53 // -----------------------------------------------------------------------------
       
    54 CEmailAddress::CEmailAddress( const TRole aRole, const TDataOwner aOwner ) :
       
    55     iRole( aRole ), 
       
    56     iOwner( aOwner )
    43     {
    57     {
    44     }
    58     }
    45 
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // 
       
    62 // -----------------------------------------------------------------------------
    46 TEmailTypeId CEmailAddress::InterfaceId() const
    63 TEmailTypeId CEmailAddress::InterfaceId() const
    47     {
    64     {
    48     return KEmailIFUidAddress;
    65     return KEmailIFUidAddress;
    49     }
    66     }
    50 
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // 
       
    70 // -----------------------------------------------------------------------------
    51 void CEmailAddress::Release()
    71 void CEmailAddress::Release()
    52     {
    72     {
    53     if ( iOwner == EClientOwns )
    73     if ( iOwner == EClientOwns )
    54         {
    74         {
    55         delete this;
    75         delete this;
    56         }
    76         }
    57     }
    77     }
    58 
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // 
       
    81 // -----------------------------------------------------------------------------
    59 void CEmailAddress::SetAddressL( const TDesC& aAddress )
    82 void CEmailAddress::SetAddressL( const TDesC& aAddress )
    60     {
    83     {
    61     iAddress.Close();
    84     iAddress.Close();
    62     iAddress.CreateL( aAddress );
    85     iAddress.CreateL( aAddress );
    63     }
    86     }
    64 
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // 
       
    90 // -----------------------------------------------------------------------------
    65 TPtrC CEmailAddress::Address() const
    91 TPtrC CEmailAddress::Address() const
    66     {    
    92     {    
    67     return iAddress;
    93     return iAddress;
    68     }
    94     }
    69     
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // 
       
    98 // -----------------------------------------------------------------------------
    70 void CEmailAddress::SetDisplayNameL( const TDesC& aDisplayName )
    99 void CEmailAddress::SetDisplayNameL( const TDesC& aDisplayName )
    71     {
   100     {
    72     iDisplayName.Close();
   101     iDisplayName.Close();
    73     iDisplayName.CreateL( aDisplayName );
   102     iDisplayName.CreateL( aDisplayName );
    74     }
   103     }
    75 
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // 
       
   107 // -----------------------------------------------------------------------------
    76 TPtrC CEmailAddress::DisplayName() const
   108 TPtrC CEmailAddress::DisplayName() const
    77     {
   109     {
    78     return iDisplayName;
   110     return iDisplayName;
    79     }
   111     }
    80     
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // 
       
   115 // -----------------------------------------------------------------------------
    81 MEmailAddress::TRole CEmailAddress::Role() const
   116 MEmailAddress::TRole CEmailAddress::Role() const
    82     {
   117     {
    83     return iRole;
   118     return iRole;
    84     }
   119     }
    85 
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // 
       
   123 // -----------------------------------------------------------------------------
    86 void CEmailAddress::SetRole( const TRole aRole )
   124 void CEmailAddress::SetRole( const TRole aRole )
    87     {
   125     {
    88     iRole = aRole;
   126     iRole = aRole;
    89     }
   127     }
    90 
   128 
    91 // End of file.
   129 // End of file