diff -r a36b1e19a461 -r 989d2f495d90 serviceproviders/sapi_serviceregistry/src/serviceregistryutilities.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_serviceregistry/src/serviceregistryutilities.cpp Fri Jul 03 15:51:24 2009 +0100 @@ -0,0 +1,72 @@ +/* +* 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 the License "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: Common utilities for ServiceRegistry Service API +* THIS FILE IS GENERATED - DO NOT MODIFY!!! +* +*/ + + +#include + +#include "serviceregistryutilities.h" +#include "serviceregistryservice.hrh" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// TServiceRegistryUtilities::ConvertInputInt32L +// Converts LIW type input Int32 into Symbian type. +// --------------------------------------------------------------------------- +// +TInt32 TServiceRegistryUtilities::ConvertInputInt32L( const CLiwGenericParamList& aInParamList, + const TDesC8& aName, + const TInt aParamIndex ) + { + // Local parameter storage + TLiwGenericParam inParam; + // Storage for return value + TInt32 retInt32( 0 ); + // Default start position for Find + TInt FindStartIndex = 0; + // Get input parameter + aInParamList.FindFirst( FindStartIndex, aName ); + if ( FindStartIndex < 0 ) + { + // Using position based parsing, if param was not found by name. + if ( aParamIndex != -1 && aInParamList.Count() > aParamIndex ) + { + inParam = aInParamList[aParamIndex]; + } + else + { + + User::Leave( SErrMissingArgument ); + } + } + else + { + inParam = aInParamList[FindStartIndex]; + } + + // Check variant type + if ( inParam.Value().TypeId() != LIW::EVariantTypeTInt32 ) + { + + User::Leave( SErrBadArgumentType ); + } + inParam.Value().Get( retInt32 ); + return retInt32; + } +