emailservices/emailstore/message_store/client/src/MsgStoreAccount.cpp
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Message store account client implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //<cmail>
       
    21 #include "MsgStoreAccount.h"
       
    22 //</cmail>
       
    23 
       
    24 EXPORT_C CMsgStoreAccount* CMsgStoreAccount::NewL( const TInt32 aOwnerUid, const TDesC& aName )
       
    25 {
       
    26 	CMsgStoreAccount* self = new(ELeave) CMsgStoreAccount();
       
    27 	CleanupStack::PushL(self);
       
    28 	self->ConstructL(aOwnerUid, aName);
       
    29 	CleanupStack::Pop( self );
       
    30 	return self;
       
    31 }
       
    32 
       
    33 EXPORT_C CMsgStoreAccount* CMsgStoreAccount::NewLC( const TInt32 aOwnerUid, const TDesC& aName )
       
    34 {
       
    35 	CMsgStoreAccount* self = new(ELeave) CMsgStoreAccount();
       
    36 	CleanupStack::PushL(self);
       
    37 	self->ConstructL(aOwnerUid, aName);
       
    38 	return self;
       
    39 }
       
    40 
       
    41 /** Constructor */
       
    42 CMsgStoreAccount::CMsgStoreAccount()
       
    43 {
       
    44 }
       
    45 
       
    46 /** Gets the owner ID */
       
    47 EXPORT_C TInt32 CMsgStoreAccount::Owner() const 
       
    48 { 
       
    49 	return iOwnerUid; 
       
    50 };
       
    51 
       
    52 /** Gets the name */
       
    53 EXPORT_C const TDesC& CMsgStoreAccount::Name() const 
       
    54 { 
       
    55 	return iName; 
       
    56 };
       
    57 
       
    58 /** Gets the owner ID */
       
    59 EXPORT_C void CMsgStoreAccount::SetOwner( TInt32 aOwner )
       
    60 { 
       
    61 	iOwnerUid = aOwner; 
       
    62 };
       
    63 
       
    64 /** Gets the name */
       
    65 EXPORT_C void CMsgStoreAccount::SetNameL( const TDesC& aName )
       
    66 { 
       
    67 	if ( iName.MaxLength() < aName.Length() )
       
    68 	{
       
    69 		iName.ReAllocL( aName.Length() );
       
    70 	}
       
    71 	iName.Copy( aName );
       
    72 };
       
    73 
       
    74 /** Destructor */
       
    75 CMsgStoreAccount::~CMsgStoreAccount()
       
    76 {
       
    77 	iName.Close();
       
    78 }
       
    79 
       
    80 void CMsgStoreAccount::ConstructL(const TInt32 aOwnerUid, const TDesC& aName)
       
    81 {
       
    82 	iOwnerUid = aOwnerUid;
       
    83 	iName.CreateL( aName );
       
    84 }