Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include "T_ParsePtrCData.h"
23 _LIT( KCmdDelete, "~" );
24 _LIT( KCmdNew, "new" );
25 _LIT( KCmdAddDir, "AddDir");
26 _LIT( KCmdPopDir, "PopDir");
29 _LIT( KParamFileName, "FileName" );
30 _LIT( KParamDirName, "DirName" );
33 CT_ParsePtrCData* CT_ParsePtrCData::NewL()
35 * Two phase constructor
38 CT_ParsePtrCData* ret = new (ELeave) CT_ParsePtrCData();
39 CleanupStack::PushL( ret );
41 CleanupStack::Pop( ret );
45 CT_ParsePtrCData::CT_ParsePtrCData()
48 * Protected constructor. First phase construction
53 void CT_ParsePtrCData::ConstructL()
55 * Protected constructor. Second phase construction
60 CT_ParsePtrCData::~CT_ParsePtrCData()
70 TParseBase* CT_ParsePtrCData::GetParse()
75 TBool CT_ParsePtrCData::DoCommandL( const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
77 * Process a command read from the ini file
79 * @param aCommand the command to process
80 * @param aSection the entry in the ini file requiring the command to be processed
82 * @return ETrue if the command is processed
87 if ( aCommand == KCmdDelete )
91 else if ( aCommand == KCmdNew )
95 else if ( aCommand == KCmdAddDir )
97 DoCmdAddDir( aSection );
99 else if ( aCommand == KCmdPopDir )
105 retVal = CT_ParseBaseData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
111 void CT_ParsePtrCData::DoCleanup()
112 /** Deletes TParsePtr class instance */
114 INFO_PRINTF1( _L( "Delete TParsePtrC class instance." ) );
120 void CT_ParsePtrCData::DoCmdNew( const TDesC& aSection )
121 /** Creates new TParsePtr class instance */
126 if ( GET_MANDATORY_STRING_PARAMETER( KParamFileName, aSection, fileName ) )
128 INFO_PRINTF2( _L( "Create new TParsePtrC(\"%S\") class instance." ), &fileName );
130 iFileName = fileName;
131 TRAPD( err, iParsePtrC = new (ELeave) TParsePtrC( iFileName ) );
132 if ( err != KErrNone )
134 ERR_PRINTF3( _L( "new TParsePtrC(\"%S\") error=%d" ), &fileName, err );
141 void CT_ParsePtrCData::DoCmdPopDir()
142 /** Removes the last directory from the path using PopDir(). */
144 INFO_PRINTF1( _L( "PopDir()" ) );
146 TInt err = iParsePtrC->PopDir();
150 ERR_PRINTF2( _L( "PopDir() returned %d error"), err);
156 void CT_ParsePtrCData::DoCmdAddDir( const TDesC& aSection )
157 /** Adds a single directory onto the end of the path using AddDir. */
160 if ( GET_MANDATORY_STRING_PARAMETER( KParamDirName, aSection, dirName ) )
162 INFO_PRINTF2( _L( "AddDir(\"%S\")" ), &dirName );
164 TInt err = iParsePtrC->AddDir( dirName );
167 ERR_PRINTF2( _L( "AddDir() returned %d error"), err);