sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@test
|
sl@0
|
21 |
@internalComponent
|
sl@0
|
22 |
v
|
sl@0
|
23 |
This contains CT_FileNamesIdenticalData
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
// User includes
|
sl@0
|
27 |
#include "T_FileNamesIdenticalData.h"
|
sl@0
|
28 |
#include "T_SfSrvServer.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
/*@{*/
|
sl@0
|
31 |
/// Parameters
|
sl@0
|
32 |
_LIT(KFile1, "file1");
|
sl@0
|
33 |
_LIT(KFile2, "file2");
|
sl@0
|
34 |
_LIT(KExpected, "expected");
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
///Commands
|
sl@0
|
38 |
_LIT(KCmdFileNamesIdentical, "FileNamesIdentical");
|
sl@0
|
39 |
|
sl@0
|
40 |
|
sl@0
|
41 |
CT_FileNamesIdenticalData* CT_FileNamesIdenticalData::NewL()
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
* Two phase constructor
|
sl@0
|
44 |
*/
|
sl@0
|
45 |
{
|
sl@0
|
46 |
CT_FileNamesIdenticalData* ret = new (ELeave) CT_FileNamesIdenticalData();
|
sl@0
|
47 |
CleanupStack::PushL(ret);
|
sl@0
|
48 |
ret->ConstructL();
|
sl@0
|
49 |
CleanupStack::Pop(ret);
|
sl@0
|
50 |
return ret;
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
|
sl@0
|
54 |
CT_FileNamesIdenticalData::CT_FileNamesIdenticalData()
|
sl@0
|
55 |
/**
|
sl@0
|
56 |
* Protected constructor. First phase construction
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
{
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
|
sl@0
|
62 |
void CT_FileNamesIdenticalData::ConstructL()
|
sl@0
|
63 |
/**
|
sl@0
|
64 |
* Protected constructor. Second phase construction
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
{
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
|
sl@0
|
70 |
CT_FileNamesIdenticalData::~CT_FileNamesIdenticalData()
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
* Destructor.
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
{
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
|
sl@0
|
78 |
TAny* CT_FileNamesIdenticalData::GetObject()
|
sl@0
|
79 |
{
|
sl@0
|
80 |
return NULL;
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
|
sl@0
|
84 |
TBool CT_FileNamesIdenticalData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt /*aAsyncErrorIndex*/)
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* Process a command read from the ini file
|
sl@0
|
87 |
*
|
sl@0
|
88 |
* @param aCommand the command to process
|
sl@0
|
89 |
* @param aSection the section in the ini file requiring the command to be processed
|
sl@0
|
90 |
*
|
sl@0
|
91 |
* @return ETrue if the command is processed
|
sl@0
|
92 |
*/
|
sl@0
|
93 |
{
|
sl@0
|
94 |
TBool retVal = ETrue;
|
sl@0
|
95 |
|
sl@0
|
96 |
if (aCommand == KCmdFileNamesIdentical)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
DoCmdFileNamesIdentical(aSection);
|
sl@0
|
99 |
}
|
sl@0
|
100 |
return retVal;
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
void CT_FileNamesIdenticalData::DoCmdFileNamesIdentical(const TDesC& aSection)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
TPtrC file1, file2;
|
sl@0
|
106 |
TBool expected;
|
sl@0
|
107 |
if(GET_MANDATORY_STRING_PARAMETER(KFile1, aSection, file1)
|
sl@0
|
108 |
&& GET_MANDATORY_STRING_PARAMETER(KFile2, aSection, file2)
|
sl@0
|
109 |
&& GET_MANDATORY_BOOL_PARAMETER(KExpected, aSection, expected))
|
sl@0
|
110 |
{
|
sl@0
|
111 |
TBool identical = EFalse;
|
sl@0
|
112 |
|
sl@0
|
113 |
INFO_PRINTF1(_L("Comparing files:"));
|
sl@0
|
114 |
INFO_PRINTF2(_L("File 1: %S"), &file1);
|
sl@0
|
115 |
INFO_PRINTF2(_L("File 2: %S"), &file2);
|
sl@0
|
116 |
|
sl@0
|
117 |
identical = FileNamesIdentical(file1,file2);
|
sl@0
|
118 |
if(identical != expected)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
ERR_PRINTF1(_L("File names are not identical and it's not expected!"));
|
sl@0
|
121 |
SetBlockResult(EFail);
|
sl@0
|
122 |
}
|
sl@0
|
123 |
else
|
sl@0
|
124 |
{
|
sl@0
|
125 |
if (expected)
|
sl@0
|
126 |
{
|
sl@0
|
127 |
INFO_PRINTF1(_L("File names are identical."));
|
sl@0
|
128 |
}
|
sl@0
|
129 |
else
|
sl@0
|
130 |
{
|
sl@0
|
131 |
INFO_PRINTF1(_L("File names are not identical, but it's expected."));
|
sl@0
|
132 |
}
|
sl@0
|
133 |
}
|
sl@0
|
134 |
}
|
sl@0
|
135 |
}
|