sysstatemgmt/systemstatemgr/cmd/src/ssmcommandparameters.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 <ssm/ssmcommandlistresourcereader.h>
       
    17 //#include <ssm/ssmcommandlist.h>
       
    18 //#include <ssm/ssmconditionalcallback.h>
       
    19 
       
    20 #include <barsc2.h>
       
    21 #include <barsread2.h>
       
    22 #include "ssmcommandparameters.h"
       
    23 #include "ssmdebug.h"
       
    24 #include "ssmpanic.h"
       
    25 //#include "ssmcommandlistresourcereaderimpl.h"
       
    26 //#include "ssmcommandlistimpl.h"
       
    27 
       
    28 TSsmCommandParameters::TSsmCommandParameters(RResourceReader& aMainReader, CResourceFile* aResourceFile, TInt aConditionalInfoResourceId)
       
    29 	: iMainReader(aMainReader), iResourceFile(aResourceFile), iOptions(ENoOptionalValuesSupplied), iConditionalInfoResourceId(aConditionalInfoResourceId), iState(0, 0), iSwp(0, 0)
       
    30 	{
       
    31 	}
       
    32 
       
    33 TSsmCommandParameters::TSsmCommandParameters(RResourceReader& aMainReader, CResourceFile* aResourceFile, TInt aConditionalInfoResourceId, const TSsmState& aState)
       
    34 	: iMainReader(aMainReader), iResourceFile(aResourceFile), iOptions(EStateSupplied), iConditionalInfoResourceId(aConditionalInfoResourceId), iState(aState), iSwp(0, 0)
       
    35 	{
       
    36 	}
       
    37 
       
    38 TSsmCommandParameters::TSsmCommandParameters(RResourceReader& aMainReader, CResourceFile* aResourceFile, TInt aConditionalInfoResourceId, const TSsmSwp& aSwp)
       
    39 	: iMainReader(aMainReader), iResourceFile(aResourceFile), iOptions(ESwpSupplied), iConditionalInfoResourceId(aConditionalInfoResourceId), iState(0, 0), iSwp(aSwp)
       
    40 	{
       
    41 	}
       
    42 
       
    43 RResourceReader& TSsmCommandParameters::MainReader()
       
    44 	{
       
    45 	return iMainReader;
       
    46 	}
       
    47 
       
    48 void TSsmCommandParameters::OpenReaderForResourceIdL(RResourceReader& aReader, TInt aResourceId)
       
    49 	{
       
    50 	aReader.OpenL(iResourceFile, aResourceId);
       
    51 	}
       
    52 
       
    53 HBufC8* TSsmCommandParameters::AllocBufferForResourceIdL(TInt aResourceId)
       
    54 	{
       
    55 	if (iResourceFile)
       
    56 		{
       
    57 		return iResourceFile->AllocReadL(aResourceId);
       
    58 		}
       
    59 		
       
    60 	return NULL;
       
    61 	}
       
    62 
       
    63 TSsmState TSsmCommandParameters::StateL()
       
    64 	{
       
    65 	SSMLOGLEAVEIFFALSE(iOptions == EStateSupplied, KErrNotSupported);
       
    66 	return iState;
       
    67 	}
       
    68 
       
    69 TSsmSwp TSsmCommandParameters::SwpL()
       
    70 	{
       
    71 	SSMLOGLEAVEIFFALSE(iOptions == ESwpSupplied, KErrNotSupported);
       
    72 	return iSwp;
       
    73 	}
       
    74 
       
    75 CResourceFile* TSsmCommandParameters::ResourceFile()
       
    76 	{
       
    77 	return iResourceFile;
       
    78 	}
       
    79 
       
    80 TInt TSsmCommandParameters::ConditionalInformation()
       
    81 	{
       
    82 	return iConditionalInfoResourceId;
       
    83 	}