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_ParsePtrData.h"
23 _LIT( KCmdDelete, "~" );
24 _LIT( KCmdNew, "new" );
25 _LIT( KCmdAddDir, "AddDir");
26 _LIT( KCmdPopDir, "PopDir");
29 _LIT( KParamFileName, "FileName" );
30 _LIT( KParamDirName, "DirName" );
32 CT_ParsePtrData* CT_ParsePtrData::NewL()
34 * Two phase constructor
37 CT_ParsePtrData* ret = new (ELeave) CT_ParsePtrData();
38 CleanupStack::PushL( ret );
40 CleanupStack::Pop( ret );
44 CT_ParsePtrData::CT_ParsePtrData( )
47 * Protected constructor. First phase construction
52 TParseBase* CT_ParsePtrData::GetParse()
57 void CT_ParsePtrData::ConstructL()
59 * Protected constructor. Second phase construction
64 CT_ParsePtrData::~CT_ParsePtrData()
73 TAny* CT_ParsePtrData::GetObject()
75 * Return a pointer to the object that the data wraps
77 * @return pointer to the object that the data wraps
83 TBool CT_ParsePtrData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex )
85 * Process a command read from the ini file
87 * @param aCommand the command to process
88 * @param aEntry the entry in the ini file requiring the command to be processed
90 * @return ETrue if the command is processed
95 if ( aCommand == KCmdDelete )
99 else if ( aCommand == KCmdNew )
101 DoCmdNew( aSection );
103 else if ( aCommand == KCmdAddDir )
105 DoCmdAddDir( aSection );
107 else if ( aCommand == KCmdPopDir )
113 retVal = CT_ParseBaseData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
119 void CT_ParsePtrData::DoCleanup()
120 /** Deletes TParsePtr class instance */
122 INFO_PRINTF1( _L( "Delete TParsePtr class instance." ) );
128 void CT_ParsePtrData::DoCmdNew( const TDesC& aSection )
129 /** Creates new TParsePtr class instance */
134 if ( GET_MANDATORY_STRING_PARAMETER( KParamFileName, aSection, fileName ) )
136 INFO_PRINTF2( _L( "Create new TParsePtr(\"%S\") class instance." ), &fileName );
138 iFileName = fileName;
139 TRAPD( err, iParsePtr = new (ELeave) TParsePtr( iFileName ) );
140 if ( err != KErrNone )
142 ERR_PRINTF3( _L( "new TParsePtr(\"%S\") error=%d" ), &fileName, err );
149 void CT_ParsePtrData::DoCmdPopDir()
150 /** Removes the last directory from the path using PopDir(). */
152 INFO_PRINTF1( _L( "PopDir()" ) );
154 TInt err = iParsePtr->PopDir();
158 ERR_PRINTF2( _L( "PopDir() returned %d error"), err);
165 void CT_ParsePtrData::DoCmdAddDir( const TDesC& aSection )
166 /** Adds a single directory onto the end of the path using AddDir. */
169 if ( GET_MANDATORY_STRING_PARAMETER( KParamDirName, aSection, dirName ) )
171 INFO_PRINTF2( _L( "AddDir(\"%S\")" ), &dirName );
173 TInt err = iParsePtr->AddDir( dirName );
176 ERR_PRINTF2( _L( "AddDir() returned %d error"), err);