1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/csmsgetdetdescinterface.inl Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,100 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <ecom/ecom.h>
1.20 +
1.21 +const TUid KUidSmsGetDetDesc = {0x10282FA5};
1.22 +
1.23 +static void CleanUpEComSmsInfoArray(TAny* aInfoArray);
1.24 +
1.25 +/**
1.26 +Static factory constructor.
1.27 +
1.28 +@return The constructed CSmsGetDetDescInterface object
1.29 +*/
1.30 +inline CSmsGetDetDescInterface* CSmsGetDetDescInterface::NewL()
1.31 + {
1.32 + RImplInfoPtrArray implInfoArray;
1.33 + TCleanupItem cleanup(CleanUpEComSmsInfoArray, &implInfoArray);
1.34 + CleanupStack::PushL(cleanup);
1.35 + // get all implementations of the SMS GetDetDesc interface
1.36 + REComSession::ListImplementationsL(KUidSmsGetDetDesc, implInfoArray);
1.37 + TInt count = implInfoArray.Count();
1.38 +
1.39 + if (count == 0)
1.40 + {
1.41 + implInfoArray.ResetAndDestroy();
1.42 + implInfoArray.Close();
1.43 + CleanupStack::PopAndDestroy(&implInfoArray);
1.44 + User::Leave(KErrNotFound);
1.45 + }
1.46 +
1.47 + CSmsGetDetDescInterface* interface = NULL;
1.48 +
1.49 + for (TInt impl = 0; impl < count; ++impl)
1.50 + {
1.51 + if (implInfoArray[impl]->VendorId() != 0x70000001)
1.52 + {
1.53 + interface = REINTERPRET_CAST(
1.54 + CSmsGetDetDescInterface*,
1.55 + REComSession::CreateImplementationL(
1.56 + implInfoArray[impl]->ImplementationUid(),
1.57 + _FOFF(CSmsGetDetDescInterface, iDtor_ID_Key)));
1.58 + }
1.59 + }
1.60 +
1.61 + if (!interface)
1.62 + {
1.63 + interface = REINTERPRET_CAST(
1.64 + CSmsGetDetDescInterface*,
1.65 + REComSession::CreateImplementationL(
1.66 + implInfoArray[0]->ImplementationUid(),
1.67 + _FOFF(CSmsGetDetDescInterface, iDtor_ID_Key)));
1.68 + }
1.69 +
1.70 + implInfoArray.ResetAndDestroy();
1.71 + implInfoArray.Close();
1.72 + CleanupStack::PopAndDestroy(&implInfoArray);
1.73 + return interface;
1.74 + }
1.75 +
1.76 +/**
1.77 +Class constructor.
1.78 +*/
1.79 +inline CSmsGetDetDescInterface::CSmsGetDetDescInterface()
1.80 + {
1.81 + }
1.82 +
1.83 +/**
1.84 +Class destructor.
1.85 +Destroy the ECOM implementation
1.86 +*/
1.87 +inline CSmsGetDetDescInterface::~CSmsGetDetDescInterface()
1.88 + {
1.89 + REComSession::DestroyedImplementation(iDtor_ID_Key);
1.90 + }
1.91 +
1.92 +
1.93 +/**
1.94 +CleanUpEComSmsInfoArray function for cleanup support of locally declared arrays.
1.95 +*/
1.96 +void CleanUpEComSmsInfoArray(TAny* aInfoArray)
1.97 + {
1.98 + RImplInfoPtrArray* infoArray = (static_cast<RImplInfoPtrArray*>(aInfoArray));
1.99 + infoArray->ResetAndDestroy();
1.100 + infoArray->Close();
1.101 + }
1.102 +
1.103 +