clock2/clockengines/clocktimezoneresolver/src/clocktimezoneresolver.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 10:12:19 +0200
changeset 0 f979ecb2b13e
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2008 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:   The source file for the CClockTimeZoneResolver class.
*
*/

// User includes
#include "clocktimezoneresolver.h"
#include "clocktimezoneresolverimpl.h"
#include "clock_debug.h"

// ---------------------------------------------------------
// CClockTimeZoneResolver::NewL
// rest of the details are commented in the header
// ---------------------------------------------------------
//
EXPORT_C CClockTimeZoneResolver* CClockTimeZoneResolver::NewL()
	{
	__PRINTS( "CClockTimeZoneResolver::NewL - Entry" );
	
	CClockTimeZoneResolver* self = new ( ELeave ) CClockTimeZoneResolver;
	CleanupStack::PushL( self );
	
	self->ConstructL();
	
	CleanupStack::Pop();
	
	__PRINTS( "CClockTimeZoneResolver::NewL - Exit" );
	
	return self;
	}
	
// ---------------------------------------------------------
// CClockTimeZoneResolver::~CClockTimeZoneResolver
// rest of the details are commented in the header
// ---------------------------------------------------------
//
EXPORT_C CClockTimeZoneResolver::~CClockTimeZoneResolver()
	{
	__PRINTS( "CClockTimeZoneResolver::~CClockTimeZoneResolver - Entry" );
	
	if( iTzResolverImpl )
		{
		delete iTzResolverImpl;
		iTzResolverImpl = NULL;
		}
	
	__PRINTS( "CClockTimeZoneResolver::~CClockTimeZoneResolver - Exit" );
	}
	
// ---------------------------------------------------------
// CClockTimeZoneResolver::ConstructL
// rest of the details are commented in the header
// ---------------------------------------------------------
//
void CClockTimeZoneResolver::ConstructL()
	{
	__PRINTS( "CClockTimeZoneResolver::ConstructL - Entry" );
	
	// Create the resolver implementation.
	if( !iTzResolverImpl )
		{
		iTzResolverImpl = CClockTimeZoneResolverImpl::NewL();
		}
	
	__PRINTS( "CClockTimeZoneResolver::ConstructL - Exit" );
	}
	
// ---------------------------------------------------------
// CClockTimeZoneResolver::GetTimeZoneL
// rest of the details are commented in the header
// ---------------------------------------------------------
//
EXPORT_C TInt CClockTimeZoneResolver::GetTimeZoneL( const STimeAttributes& aTimeInfo, 
		  									   		const RMobilePhone::TMobilePhoneNetworkCountryCode& aMcc,
		  									   		TInt& aTzId )
	{
	__PRINTS( "CClockTimeZoneResolver::GetTimeZoneL - Entry" );
	
	// Get the timezone information from the implementation.
	TInt returnVal( KErrNotFound );
	
	if( iTzResolverImpl )
		{
		returnVal = iTzResolverImpl->GetTimeZoneL( aTimeInfo, aMcc, aTzId );
		}

	__PRINTS( "CClockTimeZoneResolver::GetTimeZoneL - Exit" );

	return returnVal;
	}

// ---------------------------------------------------------
// CClockTimeZoneResolver::TzIdFromMccL
// rest of the details are commented in the header
// ---------------------------------------------------------
//
EXPORT_C void CClockTimeZoneResolver::TzIdFromMccL( const RMobilePhone::TMobilePhoneNetworkCountryCode& aMCC,
											   		RArray< CTzId >& aTzIdArray,
											   		const TTimeIntervalMinutes& aStdTimeOffset )
	{
	__PRINTS( "CClockTimeZoneResolver::TzIdFromMccL - Entry" );
	
	if( iTzResolverImpl )
	    {
	    iTzResolverImpl->TzIdFromMccL( aMCC, aTzIdArray, aStdTimeOffset );
	    }
	
	__PRINTS( "CClockTimeZoneResolver::TzIdFromMccL - Exit" );
	}

// ---------------------------------------------------------
// CClockTimeZoneResolver::MCCFromTzIdL
// rest of the details are commented in the header
// ---------------------------------------------------------
//
EXPORT_C TInt CClockTimeZoneResolver::MCCFromTzIdL( const CTzId& aTzId )
	{
	__PRINTS( "CClockTimeZoneResolver::MCCFromTzIdL - Entry" );
	
	TInt returnVal( KErrNotFound );
	
	if( iTzResolverImpl )
		{
		returnVal = iTzResolverImpl->MCCFromTzIdL( aTzId );
		}
	
	__PRINTS( "CClockTimeZoneResolver::MCCFromTzIdL - Exit" );

	return returnVal;
	}

// End of file