|
1 /* |
|
2 * Copyright (c) 2008 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 "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: Implementation of application entry point functions. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <apmrec.h> |
|
21 #include <apmstd.h> |
|
22 #include <e32svr.h> |
|
23 #include <ImplementationProxy.h> |
|
24 |
|
25 #include "Pk5Recognizer.h" |
|
26 #include <barsread.h> |
|
27 #include <EikEnv.h> |
|
28 #include <f32file.h> |
|
29 |
|
30 // CONSTANTS |
|
31 const TUid KUidPk5Recognizer={0x2000FD89}; |
|
32 _LIT8(KPk5MimeType, "application/vnd.nokia.pk5"); |
|
33 const TInt KMaxBufferSize(512); |
|
34 _LIT(KPk5Extension, ".pk5"); |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 // --------------------------------------------------------- |
|
39 // CPk5Recognizer::CPk5Recognizer() |
|
40 // --------------------------------------------------------- |
|
41 // |
|
42 CPk5Recognizer::CPk5Recognizer() |
|
43 :CApaDataRecognizerType( |
|
44 KUidPk5Recognizer, |
|
45 CApaDataRecognizerType::ENormal ) |
|
46 { |
|
47 iCountDataTypes = 1; |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------- |
|
51 // CPk5Recognizer::~CPk5Recognizer() |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 CPk5Recognizer::~CPk5Recognizer() |
|
55 { |
|
56 |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // CPk5Recognizer::NewL() |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 CPk5Recognizer* CPk5Recognizer::NewL() |
|
64 { |
|
65 CPk5Recognizer* self = new(ELeave) CPk5Recognizer(); |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop(); |
|
69 return self; |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CPk5Recognizer::ConstructL() |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 void CPk5Recognizer::ConstructL() |
|
77 { |
|
78 |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------- |
|
82 // CPk5Recognizer::PreferredBufSize() |
|
83 // --------------------------------------------------------- |
|
84 // |
|
85 TUint CPk5Recognizer::PreferredBufSize() |
|
86 { |
|
87 return KMaxBufferSize; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CPk5Recognizer::SupportedDataTypeL() |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 TDataType CPk5Recognizer::SupportedDataTypeL(TInt /*aIndex*/) const |
|
95 { |
|
96 return TDataType(KPk5MimeType); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // CPk5Recognizer::DoRecognizeL() |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 void CPk5Recognizer::DoRecognizeL(const TDesC& aName, const TDesC8& /*aBuffer*/) |
|
104 { |
|
105 iConfidence = ENotRecognized; |
|
106 |
|
107 if ( aName.Length() > KPk5Extension().Length() ) |
|
108 { |
|
109 TPtrC extension = aName.Right( KPk5Extension().Length() ); |
|
110 |
|
111 if( extension.Compare( KPk5Extension ) == 0 ) |
|
112 { |
|
113 iDataType = TDataType(KPk5MimeType); |
|
114 iConfidence = ECertain; |
|
115 } |
|
116 } |
|
117 } |
|
118 |
|
119 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CApaDataRecognizerType* CreateRecognizer |
|
123 // The gate function - ordinal 1 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 #ifdef EKA2 |
|
127 |
|
128 // --------------------------------------------------------- |
|
129 // CPk5Recognizer::CreateRecognizerL() |
|
130 // --------------------------------------------------------- |
|
131 // |
|
132 CApaDataRecognizerType* CPk5Recognizer::CreateRecognizerL() |
|
133 { |
|
134 return CPk5Recognizer::NewL(); |
|
135 } |
|
136 |
|
137 const TImplementationProxy ImplementationTable[] = |
|
138 { |
|
139 IMPLEMENTATION_PROXY_ENTRY(KPk5RecognizerImplementationUid, |
|
140 CPk5Recognizer::CreateRecognizerL) |
|
141 }; |
|
142 |
|
143 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
144 { |
|
145 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
146 return ImplementationTable; |
|
147 } |
|
148 |
|
149 #else |
|
150 EXPORT_C CApaDataRecognizerType* CreateRecognizer() |
|
151 { |
|
152 CApaDataRecognizerType* thing=new CPk5Recognizer(); |
|
153 return thing; // NULL if new failed |
|
154 } |
|
155 |
|
156 #endif |
|
157 // ----------------------------------------------------------------------------- |
|
158 // E32Dll |
|
159 // DLL entry point |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 |
|
163 #ifndef EKA2 |
|
164 GLDEF_C TInt E32Dll(TDllReason /*aReason*/) |
|
165 { |
|
166 return KErrNone; |
|
167 } |
|
168 #endif |
|
169 |
|
170 // End of File |