testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/src/symbianunittestcommandlineparser.cpp
author Johnson Ma <johnson.ma@nokia.com>
Mon, 29 Mar 2010 14:46:27 +0800
changeset 1 bbd31066657e
parent 0 3e07fef1e154
permissions -rw-r--r--
publish symbianunittest v1.1.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     1
/*
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     8
*
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    11
*
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    12
* Contributors:
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    13
*
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    14
* Description:  
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    15
*
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    16
*/
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    17
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    18
#include "symbianunittestcommandlineparser.h"
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    19
#include "symbianunittestdllnameparser.h"
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    20
#include "symbianunittestrunner.h"
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    21
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    22
_LIT( KHelpKey, "-help" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    23
_LIT( KHelpKeyShort, "-h" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    24
_LIT( KTestsKey, "-tests=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    25
_LIT( KTestsKeyShort, "-t=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    26
_LIT( KTestCasesKey, "-cases=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    27
_LIT( KTestCasesKeyShort, "-c=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    28
_LIT( KAllocKey, "-alloc" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    29
_LIT( KAllocKeyShort, "-a" );
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
    30
_LIT( KBackgroundKey, "-background" );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
    31
_LIT( KBackgroundKeyShort, "-b" );
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    32
_LIT( KOutputKey, "-output=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    33
_LIT( KOutputKeyShort, "-o=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    34
_LIT( KNoPromptKey, "-noprompt" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    35
_LIT( KTimeoutKey, "-timeout=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    36
_LIT( KTimeoutKeyShort, "-to=" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    37
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    38
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    39
_LIT( KOutputFileName, "SymbianUnitTestResults" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    40
_LIT( KDefaultOutputFormat, "html" );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    41
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    43
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    44
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    45
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    46
CSymbianUnitTestCommandLineParser* CSymbianUnitTestCommandLineParser::NewLC()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    47
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    48
    CSymbianUnitTestCommandLineParser* self = 
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    49
        new( ELeave )CSymbianUnitTestCommandLineParser();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    50
    CleanupStack::PushL( self );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    51
    self->ConstructL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    52
    return self;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    53
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    54
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    55
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    56
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    57
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    58
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    59
CSymbianUnitTestCommandLineParser* CSymbianUnitTestCommandLineParser::NewL()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    60
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    61
    CSymbianUnitTestCommandLineParser* self = 
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    62
        CSymbianUnitTestCommandLineParser::NewLC();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    63
    CleanupStack::Pop( self );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    64
    return self;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    65
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    66
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    67
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    68
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    69
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    70
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    71
CSymbianUnitTestCommandLineParser::CSymbianUnitTestCommandLineParser()
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
    72
	: iBackground( EFalse )
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    73
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    74
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    75
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    76
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    77
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    78
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    79
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    80
void CSymbianUnitTestCommandLineParser::ConstructL()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    81
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    82
    iArguments = CCommandLineArguments::NewL();   
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    83
    TPtrC dummy;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    84
    iShowHelp =  FindArgument( KHelpKey, KHelpKeyShort, dummy );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    85
    iAllocFailureSimulation = FindArgument( KAllocKey, KAllocKeyShort, dummy );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    86
    iNoPrompt = FindArgument( KNoPromptKey, KNoPromptKey, dummy );
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
    87
    iBackground = FindArgument( KBackgroundKey, KBackgroundKeyShort, dummy );
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    88
    SetOutputFormatL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    89
    SetTimeoutL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    90
    SetTestDllNamesL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    91
    SetTestCaseNamesL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    92
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    93
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    94
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    95
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    96
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    97
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    98
CSymbianUnitTestCommandLineParser::~CSymbianUnitTestCommandLineParser()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
    99
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   100
    delete iTestDllNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   101
    delete iTestCaseNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   102
    delete iOutputFormat;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   103
    delete iArguments;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   104
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   105
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   106
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   107
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   108
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   109
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   110
TBool CSymbianUnitTestCommandLineParser::ShowHelp() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   111
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   112
    return iShowHelp;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   113
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   114
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   115
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   116
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   117
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   118
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   119
const MDesCArray& CSymbianUnitTestCommandLineParser::TestDllNames() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   120
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   121
    return *iTestDllNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   122
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   123
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   124
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   125
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   126
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   127
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   128
const CDesCArray& CSymbianUnitTestCommandLineParser::TestCaseNames() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   129
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   130
    return *iTestCaseNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   131
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   132
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   133
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   134
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   135
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   136
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   137
TBool CSymbianUnitTestCommandLineParser::MemoryAllocationFailureSimulation() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   138
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   139
    return iAllocFailureSimulation;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   140
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   141
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   142
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   143
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   144
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   145
//
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   146
TBool CSymbianUnitTestCommandLineParser::Background() const
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   147
    {
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   148
    return iBackground;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   149
    }
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   150
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   151
// -----------------------------------------------------------------------------
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   152
//
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   153
// -----------------------------------------------------------------------------
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   154
//
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   155
const TDesC& CSymbianUnitTestCommandLineParser::OutputFileName() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   156
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   157
    return KOutputFileName;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   158
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   159
    
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   160
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   161
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   162
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   163
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   164
const TDesC& CSymbianUnitTestCommandLineParser::OutputFormat() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   165
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   166
    return *iOutputFormat;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   167
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   168
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   169
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   170
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   171
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   172
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   173
TInt CSymbianUnitTestCommandLineParser::Timeout() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   174
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   175
    return iTimeout;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   176
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   177
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   178
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   179
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   180
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   181
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   182
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   183
TBool CSymbianUnitTestCommandLineParser::PromptUser() const
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   184
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   185
    return !iNoPrompt;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   186
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   187
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   188
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   189
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   190
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   191
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   192
void CSymbianUnitTestCommandLineParser::SetOutputFormatL()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   193
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   194
    HBufC* outputFormat = NULL;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   195
    TPtrC outputFormatPtr;
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   196
    TBool found = EFalse;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   197
    found = FindArgument( KOutputKey, KOutputKeyShort, outputFormatPtr );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   198
    if ( found )
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   199
        {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   200
        outputFormat = outputFormatPtr.AllocL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   201
        }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   202
    else
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   203
        {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   204
        outputFormat = KDefaultOutputFormat().AllocL();
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   205
        }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   206
    delete iOutputFormat;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   207
    iOutputFormat = outputFormat;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   208
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   209
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   210
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   211
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   212
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   213
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   214
void CSymbianUnitTestCommandLineParser::SetTimeoutL()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   215
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   216
    iTimeout = KSymbianUnitTestDefaultTimeout; //use default
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   217
    TPtrC timeoutPtr;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   218
    TBool hasTimeout = FindArgument( KTimeoutKey, KTimeoutKeyShort, timeoutPtr );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   219
    if ( hasTimeout)
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   220
        {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   221
        TLex timeoutLex(timeoutPtr);
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   222
		TInt timeout;
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   223
        TInt ret = timeoutLex.Val(timeout);
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   224
        hasTimeout = ( ret == KErrNone && timeout >= 0 );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   225
		if ( hasTimeout ) 
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   226
	    	{
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   227
		    iTimeout = timeout;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   228
		    }
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   229
        }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   230
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   231
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   232
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   233
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   234
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   235
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   236
void CSymbianUnitTestCommandLineParser::SetTestDllNamesL()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   237
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   238
    CDesCArray* testDllNames = new( ELeave )CDesCArrayFlat( 1 );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   239
    CleanupStack::PushL( testDllNames );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   240
    TPtrC testDllNamesPtr;
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   241
    TBool found = EFalse;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   242
    found = FindArgument( KTestsKey, KTestsKeyShort, testDllNamesPtr );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   243
    if ( found )
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   244
        {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   245
        TSymbianUnitTestDllNameParser parser;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   246
        parser.Parse( testDllNamesPtr );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   247
        TPtrC testDllNamePtr;
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   248
        TBool hasNext = EFalse;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   249
        hasNext = ( parser.GetNext( testDllNamePtr ) == KErrNone );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   250
        while ( hasNext )
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   251
            {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   252
            testDllNames->AppendL( testDllNamePtr );
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   253
            hasNext = ( parser.GetNext( testDllNamePtr ) == KErrNone );
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   254
            }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   255
        }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   256
    iShowHelp = ( testDllNames->Count() == 0 );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   257
    CleanupStack::Pop( testDllNames );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   258
    delete iTestDllNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   259
    iTestDllNames = testDllNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   260
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   261
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   262
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   263
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   264
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   265
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   266
void CSymbianUnitTestCommandLineParser::SetTestCaseNamesL()
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   267
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   268
    CDesCArray* testCaseNames = new( ELeave )CDesCArrayFlat( 1 );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   269
    CleanupStack::PushL( testCaseNames );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   270
    TPtrC testCaseNamesPtr;
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   271
    TBool found = EFalse;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   272
    found = FindArgument( KTestCasesKey, KTestCasesKeyShort, testCaseNamesPtr );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   273
    if ( found )
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   274
        {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   275
	//reuse the testdll parser here for case names
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   276
        TSymbianUnitTestDllNameParser parser;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   277
        parser.Parse( testCaseNamesPtr );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   278
        TPtrC testCaseNamePtr;
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   279
        TBool hasNext = EFalse;
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   280
        hasNext = ( parser.GetNext( testCaseNamePtr ) == KErrNone );
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   281
        while ( hasNext )
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   282
            {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   283
            testCaseNames->AppendL( testCaseNamePtr );
1
bbd31066657e publish symbianunittest v1.1.0
Johnson Ma <johnson.ma@nokia.com>
parents: 0
diff changeset
   284
            hasNext = ( parser.GetNext( testCaseNamePtr ) == KErrNone );
0
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   285
            }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   286
        }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   287
    CleanupStack::Pop( testCaseNames );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   288
    delete iTestCaseNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   289
    iTestCaseNames = testCaseNames;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   290
    }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   291
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   292
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   293
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   294
// -----------------------------------------------------------------------------
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   295
//
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   296
TBool CSymbianUnitTestCommandLineParser::FindArgument( 
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   297
    const TDesC& aKey,
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   298
    const TDesC& aShortKey,
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   299
    TPtrC& aValue )
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   300
    {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   301
    TBool found( EFalse );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   302
    for ( TInt i = 0; i < iArguments->Count(); i++ )
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   303
        {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   304
        TPtrC arg( iArguments->Arg( i ) );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   305
        if ( arg.FindF( aKey ) == 0 || arg.FindF( aShortKey ) == 0 )
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   306
            {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   307
            found = ETrue;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   308
            TInt equalsPos = arg.Locate( '=' );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   309
            if ( equalsPos > 0 & equalsPos < arg.Length() - 1 ) 
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   310
                {
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   311
                aValue.Set( arg.Mid( equalsPos + 1 ) );
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   312
                }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   313
            }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   314
        }
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   315
    return found;
3e07fef1e154 Initial EPL Contribution
Johnson Ma <johnson.ma@nokia.com>
parents:
diff changeset
   316
    }