1 /* |
|
2 * Copyright (c) 2008-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 * This file implements a package file recognizer for the Reference Installer. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <apmrec.h> |
|
21 #include <apmstd.h> |
|
22 #include <ecom/ecom.h> |
|
23 #include <ecom/implementationproxy.h> |
|
24 #include "tsifpkgrec.h" |
|
25 |
|
26 const TUid KUidTestPkgRecDll = {0x102866F0}; |
|
27 const TInt KUidTestPkgRecImpl = 0x102866F1; |
|
28 const TInt KTestNumMimeTypes = 1; |
|
29 const TInt KMaxBufferLength = 0xf; |
|
30 |
|
31 /** |
|
32 A file extension and MIME type for reference package files. |
|
33 */ |
|
34 _LIT(KTestPkgFileExt, ".siftestpkg"); |
|
35 _LIT8(KDataTestMimeType, "binary/sif-testpkg"); |
|
36 |
|
37 CTestSifPkgRecognizer::CTestSifPkgRecognizer() |
|
38 : CApaDataRecognizerType(KUidTestPkgRecDll, CApaDataRecognizerType::EHigh) |
|
39 { |
|
40 iCountDataTypes = KTestNumMimeTypes; |
|
41 } |
|
42 |
|
43 TUint CTestSifPkgRecognizer::PreferredBufSize() |
|
44 { |
|
45 return KMaxBufferLength; |
|
46 } |
|
47 |
|
48 TDataType CTestSifPkgRecognizer::SupportedDataTypeL(TInt /*aIndex*/) const |
|
49 { |
|
50 return TDataType(KDataTestMimeType); |
|
51 } |
|
52 |
|
53 void CTestSifPkgRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& /*aBuffer*/) |
|
54 { |
|
55 |
|
56 // This recognition is based only on the file extension |
|
57 const TInt dotPos = aName.LocateReverse('.'); |
|
58 if (dotPos == KErrNotFound) |
|
59 { |
|
60 iConfidence = ENotRecognized; |
|
61 return; |
|
62 } |
|
63 TInt extLen = aName.Length() - dotPos; |
|
64 if (aName.Right(extLen).CompareF(KTestPkgFileExt) == 0) |
|
65 { |
|
66 iDataType = TDataType(KDataTestMimeType); |
|
67 iConfidence = ECertain; |
|
68 } |
|
69 } |
|
70 |
|
71 CApaDataRecognizerType* CTestSifPkgRecognizer::CreateRecognizerL() |
|
72 { |
|
73 return new (ELeave) CTestSifPkgRecognizer(); |
|
74 } |
|
75 |
|
76 const TImplementationProxy ImplementationTable[] = |
|
77 { |
|
78 IMPLEMENTATION_PROXY_ENTRY(KUidTestPkgRecImpl, CTestSifPkgRecognizer::CreateRecognizerL) |
|
79 }; |
|
80 |
|
81 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
82 { |
|
83 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
84 return ImplementationTable; |
|
85 } |
|