sysstatemgmt/systemstarter/src/SystemStartupStateInfo.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "SystemStartupStateInfo.h"
       
    17 
       
    18 //
       
    19 // Standard Symbian factory functions/destructor
       
    20 //
       
    21 
       
    22 CSystemStartupStateInfo* CSystemStartupStateInfo::NewL()
       
    23 	{
       
    24 	CSystemStartupStateInfo* self = CSystemStartupStateInfo::NewLC();
       
    25 	CleanupStack::Pop(self);
       
    26 	return self;
       
    27 	}
       
    28 
       
    29 CSystemStartupStateInfo* CSystemStartupStateInfo::NewLC()
       
    30 	{
       
    31 	CSystemStartupStateInfo* self = new (ELeave) CSystemStartupStateInfo;
       
    32 	CleanupStack::PushL(self);
       
    33 	self->ConstructL();
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 CSystemStartupStateInfo::~CSystemStartupStateInfo()
       
    38 	{
       
    39 	TInt i = 0;
       
    40 	for (; i < Count(); ++i)
       
    41 		{
       
    42 		iCommandList[i]->Release();
       
    43 		}
       
    44 	iCommandList.Close();
       
    45 	
       
    46 	delete iName;
       
    47 	}
       
    48 
       
    49 //
       
    50 // Public member functions
       
    51 //
       
    52 
       
    53 void CSystemStartupStateInfo::SetCommandList(CommandList aCommandList)
       
    54 	{
       
    55 	for (TInt i = 0; i < Count(); ++i)
       
    56 		{
       
    57 		delete iCommandList[i];
       
    58 		}
       
    59 	iCommandList.Close();
       
    60 	iCommandList = aCommandList;
       
    61 	}
       
    62 
       
    63 void CSystemStartupStateInfo::SetStateId(TUint8 aStateId)
       
    64 	{
       
    65 	iStateId = aStateId;
       
    66 	}
       
    67 	
       
    68 void CSystemStartupStateInfo::SetName(const TDesC& aName)
       
    69 	{
       
    70 	delete iName;
       
    71 	iName = aName.Alloc();
       
    72 	}
       
    73 	
       
    74 void CSystemStartupStateInfo::SetNoOfRetries(TNoOfRetries aNoOfRetries)
       
    75 	{
       
    76 	iNoOfRetries = aNoOfRetries;
       
    77 	}
       
    78 	
       
    79 void CSystemStartupStateInfo::SetActionOnStateTransitionFailure(TActionOnStateTransitionFailure aActionOnStateTransitionFailure)
       
    80 	{
       
    81 	iActionOnStateTransitionFailure = aActionOnStateTransitionFailure;
       
    82 	}
       
    83 	
       
    84 TInt CSystemStartupStateInfo::AddCommand(MStartupCommand* aAppInfo)
       
    85 	{
       
    86 	return iCommandList.Append(aAppInfo);
       
    87 	}
       
    88 
       
    89 //
       
    90 // Inherited virtual overrides (MStartupStateInfo)
       
    91 //
       
    92 
       
    93 TUint8 CSystemStartupStateInfo::StateId() const
       
    94 	{
       
    95 	return iStateId;
       
    96 	}
       
    97 		
       
    98 TPtrC CSystemStartupStateInfo::Name() const
       
    99 	{
       
   100 	TPtrC retval;
       
   101 	if (iName)
       
   102 		{
       
   103 		retval.Set(*iName);
       
   104 		}
       
   105 	return retval;
       
   106 	}
       
   107 
       
   108 TNoOfRetries CSystemStartupStateInfo::NoOfRetries() const  
       
   109  	{
       
   110  	return iNoOfRetries;
       
   111  	}
       
   112  
       
   113 TActionOnStateTransitionFailure CSystemStartupStateInfo::ActionOnStateTransitionFailure() const
       
   114 	{
       
   115 	return iActionOnStateTransitionFailure;
       
   116 	}
       
   117     
       
   118  
       
   119 const CommandList CSystemStartupStateInfo::GetCommandList() const
       
   120 	{
       
   121 	return iCommandList;
       
   122 	}
       
   123 	
       
   124  
       
   125 TInt CSystemStartupStateInfo::Count() const
       
   126 	{
       
   127 	return iCommandList.Count();
       
   128 	}
       
   129 
       
   130 MStartupCommand* CSystemStartupStateInfo::GetCommand(TInt aIndex) const
       
   131 	{
       
   132 	return iCommandList[aIndex];
       
   133 	}
       
   134 
       
   135 //
       
   136 // Private member functions
       
   137 //
       
   138 
       
   139 CSystemStartupStateInfo::CSystemStartupStateInfo()
       
   140 : iNoOfRetries(ERetry0), iActionOnStateTransitionFailure(EIgnoreFailure)
       
   141 	{
       
   142 	}
       
   143 
       
   144 void CSystemStartupStateInfo::ConstructL()
       
   145 	{
       
   146 	}
       
   147