libraries/iosrv/inc/ioutils.inl
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // ioutils.inl
       
     2 // 
       
     3 // Copyright (c) 2009 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "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 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 template <class SubCmnd> CServerCommandConstructor& CServerCommandFactory::AddLeafCommandL()
       
    14 	{
       
    15 	CServerCommandConstructor* cmnd;
       
    16 	if (iCif)
       
    17 		{
       
    18 		CServerCommandBase* commandBase = SubCmnd::NewLC();
       
    19 		const CCommandInfoFile* cif = iCif->SubCommand(commandBase->Name());
       
    20 		CleanupStack::PopAndDestroy(commandBase);
       
    21 		cmnd = CServerCommandConstructor::NewLC(SubCmnd::NameS(), &SubCmnd::NewLC, *this, iReporter, cif);
       
    22 		}
       
    23 	else
       
    24 		{
       
    25 		cmnd = CServerCommandConstructor::NewLC(SubCmnd::NameS(), &SubCmnd::NewLC, *this, iReporter, NULL);
       
    26 		}
       
    27 	AddSubCommandL(cmnd);
       
    28 	CleanupStack::Pop(cmnd);
       
    29 	return *cmnd;
       
    30 	}
       
    31 	
       
    32 template <class SubCmnd> CServerCommandFactory& CServerCommandFactory::AddFactoryCommandL()
       
    33 	{
       
    34 	CServerCommandFactory* cmnd;
       
    35 	if (iCif)
       
    36 		{
       
    37 		CServerCommandBase* commandBase = SubCmnd::NewLC();
       
    38 		const CCommandInfoFile* cif = iCif->SubCommand(commandBase->Name());
       
    39 		CleanupStack::PopAndDestroy(commandBase);
       
    40 		cmnd = CServerCommandFactory::NewLC(SubCmnd::NameS(), &SubCmnd::NewLC, iReporter, cif);
       
    41 		}
       
    42 	else
       
    43 		{
       
    44 		cmnd = CServerCommandFactory::NewLC(SubCmnd::NameS(), &SubCmnd::NewLC, iReporter, NULL);
       
    45 		}
       
    46 	AddSubCommandL(cmnd);
       
    47 	CleanupStack::Pop(cmnd);
       
    48 	return *cmnd;
       
    49 	}
       
    50 
       
    51