diff -r 000000000000 -r 72b543305e3a email/imum/Utils/Inc/ImumInSettingsDataAttribute.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/email/imum/Utils/Inc/ImumInSettingsDataAttribute.inl Thu Dec 17 08:44:11 2009 +0200 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ImumInSettingsDataAttribute.inl +* +*/ + + +#include + +// --------------------------------------------------------------------------- +// CImumInSettingsDataAttribute::Value() +// --------------------------------------------------------------------------- +// +template +void CImumInSettingsDataAttribute::Value( T& aAttribute ) const + { + // Copy the value in the + if ( iType == ECmpNormal ) + { + reinterpret_cast( &aAttribute )->Copy( + *reinterpret_cast( iValue ) ); + } + else if ( iType == ECmpNormal8 ) + { + reinterpret_cast( &aAttribute )->Copy( + *reinterpret_cast( iValue ) ); + } + else + { + aAttribute = *reinterpret_cast( iValue ); + } + } + +// --------------------------------------------------------------------------- +// CImumInSettingsDataAttribute::DeleteNumber() +// --------------------------------------------------------------------------- +// +template +void CImumInSettingsDataAttribute::DeleteNumber() + { + delete reinterpret_cast( iValue ); + delete reinterpret_cast( iDefault ); + } + + +// --------------------------------------------------------------------------- +// CImumInSettingsDataAttribute::DoAllocL() +// --------------------------------------------------------------------------- +// +template +void CImumInSettingsDataAttribute::DoAllocL( + const TAny* aValue, + const TAny* aDefault ) + { + // First step is to reserve memory, so the value can be stored permanently + T* value = new ( ELeave ) T(); + T* defaultValue = new ( ELeave ) T(); + + // Get the content of the pointer and store it into the attribute + *value = *reinterpret_cast( aValue ); + *defaultValue = *reinterpret_cast( aDefault ); + + // Finally store the pointer of the attribute + iValue = value; + iDefault = defaultValue; + } + +// End of File \ No newline at end of file