|
1 /* |
|
2 * Copyright (c) 2005-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 <apmrec.h> |
|
20 #include <apmstd.h> |
|
21 #include <asn1cons.h> |
|
22 #include <ecom/ecom.h> |
|
23 #include <ecom/implementationproxy.h> |
|
24 |
|
25 #include "tmimerecog.h" |
|
26 |
|
27 |
|
28 const TInt KTMimeRecognizerValue = 0x1028191c; |
|
29 const TUid KUidTMimeRecognizer = { KTMimeRecognizerValue }; |
|
30 |
|
31 // test mime type |
|
32 _LIT8( KDataTestMimeType, "x-epoc/x-dummymime-app" ); |
|
33 |
|
34 |
|
35 |
|
36 // ---------------------------------------------------------------------------- |
|
37 // CApaTMimeRecognizer |
|
38 // |
|
39 |
|
40 CApaTMimeRecognizer::CApaTMimeRecognizer() |
|
41 : CApaDataRecognizerType( KUidTMimeRecognizer, CApaDataRecognizerType::ENormal ) |
|
42 { |
|
43 iCountDataTypes = 1; |
|
44 } |
|
45 |
|
46 |
|
47 |
|
48 TUint CApaTMimeRecognizer::PreferredBufSize() |
|
49 { |
|
50 return 0; |
|
51 } |
|
52 |
|
53 |
|
54 |
|
55 TDataType CApaTMimeRecognizer::SupportedDataTypeL( TInt aIndex ) const |
|
56 { |
|
57 __ASSERT_DEBUG( aIndex >= 0 && aIndex < 1, |
|
58 User::Panic( _L("TMIMEREC"), 0 ) ); |
|
59 switch ( aIndex ) |
|
60 { |
|
61 case 0: |
|
62 return TDataType( KDataTestMimeType ); |
|
63 default: |
|
64 return TDataType( KDataTestMimeType ); |
|
65 } |
|
66 } |
|
67 |
|
68 void CApaTMimeRecognizer::DoRecognizeL( const TDesC& aName, const TDesC8& /*aBuffer*/ ) |
|
69 { |
|
70 TInt pos=aName.Locate('.'); |
|
71 TInt elen=aName.Length()-pos; |
|
72 if (aName.Right(elen).CompareF(_L(".tsym"))==0) |
|
73 { |
|
74 iDataType = TDataType( KDataTestMimeType ); |
|
75 iConfidence = EProbable; |
|
76 } |
|
77 } |
|
78 |
|
79 CApaDataRecognizerType* CApaTMimeRecognizer::CreateRecognizerL() |
|
80 { |
|
81 return new (ELeave) CApaTMimeRecognizer(); |
|
82 } |
|
83 |
|
84 const TImplementationProxy ImplementationTable[] = |
|
85 { |
|
86 IMPLEMENTATION_PROXY_ENTRY(0x1028191b, CApaTMimeRecognizer::CreateRecognizerL) |
|
87 }; |
|
88 |
|
89 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
90 { |
|
91 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
92 return ImplementationTable; |
|
93 } |
|
94 |