|
1 /* |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "recsisx.h" |
|
20 #include "dessisdataprovider.h" |
|
21 #include "swicommon.h" |
|
22 #include <apadef.h> |
|
23 #include "patchdata.h" |
|
24 #include <ecom/ecom.h> |
|
25 #include <ecom/implementationproxy.h> |
|
26 #include <u32hal.h> |
|
27 |
|
28 using namespace Swi; |
|
29 |
|
30 CApaSisxRecognizer::CApaSisxRecognizer() : CApaDataRecognizerType (KApaSisx, |
|
31 CApaDataRecognizerType::ENormal) |
|
32 { |
|
33 iCountDataTypes = KSupportedDataTypesTotal; |
|
34 } |
|
35 |
|
36 TUint CApaSisxRecognizer::PreferredBufSize () |
|
37 { |
|
38 return sizeof(TCheckedUid); |
|
39 } |
|
40 |
|
41 TDataType CApaSisxRecognizer::SupportedDataTypeL (TInt /*aIndex*/) const |
|
42 { |
|
43 return TDataType(KDataTypeSisx); |
|
44 } |
|
45 |
|
46 void CApaSisxRecognizer::DoRecognizeL (const TDesC& aName, const TDesC8& aBuffer) |
|
47 { |
|
48 iDataType = TDataType(KDataTypeSisx); |
|
49 iConfidence = ENotRecognized; |
|
50 if (aBuffer.Size() < sizeof(TCheckedUid)) |
|
51 { |
|
52 return; |
|
53 } |
|
54 TCheckedUid checkedUID(aBuffer.Mid(0, sizeof(TCheckedUid)) ); |
|
55 if (checkedUID.UidType()[0] != KUidSisxFile) |
|
56 return; |
|
57 |
|
58 const TInt positionOfExtDelimiter=aName.LocateReverse(TChar(KExtDelimiter)); |
|
59 TUint8 patchableConst = KSisxRecognizerConst; |
|
60 |
|
61 #ifdef __WINS__ |
|
62 // For the emulator allow the constant to be patched via epoc.ini |
|
63 UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalIntProperty, |
|
64 (TAny*)"KSisxRecognizerConst", &patchableConst); // read emulator property (if present) |
|
65 #endif |
|
66 |
|
67 if (patchableConst) |
|
68 { |
|
69 if (positionOfExtDelimiter >= 0) |
|
70 { |
|
71 if ((aName.Mid(positionOfExtDelimiter).CompareF(KFileExtensionSisx) == 0) || |
|
72 (aName.Mid(positionOfExtDelimiter).CompareF(KFileExtensionLegacySis) == 0)) |
|
73 { |
|
74 iConfidence = ECertain; |
|
75 } |
|
76 // All other extentions will be set to ENotRecognized |
|
77 } |
|
78 } |
|
79 else |
|
80 { |
|
81 // When KSisxRecognizerConst is zero, use the following method to recognise file extentions |
|
82 if ((positionOfExtDelimiter >= 0) && |
|
83 (aName.Mid(positionOfExtDelimiter).CompareF(KFileExtensionSisx) == 0)) |
|
84 { |
|
85 iConfidence = ECertain; |
|
86 } |
|
87 else |
|
88 { |
|
89 iConfidence = EPossible; |
|
90 } |
|
91 } |
|
92 } |
|
93 |
|
94 CApaDataRecognizerType* CApaSisxRecognizer::CreateRecognizerL() |
|
95 { |
|
96 return new (ELeave) CApaSisxRecognizer(); |
|
97 } |
|
98 |
|
99 const TImplementationProxy ImplementationTable[] = |
|
100 { |
|
101 IMPLEMENTATION_PROXY_ENTRY(0x10204FC7, CApaSisxRecognizer::CreateRecognizerL) |
|
102 }; |
|
103 |
|
104 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
105 { |
|
106 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
107 return ImplementationTable; |
|
108 } |
|
109 |