00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <eikenv.h>
00020 #include <implementationproxy.h>
00021
00022
00023 #include "exampleRecognizer.h"
00024
00025 const TInt KNumDataTypes = 1;
00026 const TUid KExampleDllUid = {0xE8000002};
00027 const TInt KImplementationUid = 0x101F7DA1;
00028
00029
00030 _LIT8(KExampleTextMimeType, "text/example");
00031
00032
00033
00034
00035
00036 CExampleNewRecognizer::CExampleNewRecognizer():CApaDataRecognizerType(KExampleDllUid, CApaDataRecognizerType::EHigh)
00037 {
00038 iCountDataTypes = KNumDataTypes;
00039 }
00040
00041
00042
00043
00044
00045 TUint CExampleNewRecognizer::PreferredBufSize()
00046 {
00047 return 24;
00048 }
00049
00050
00051
00052
00053
00054
00055 TDataType CExampleNewRecognizer::SupportedDataTypeL(TInt ) const
00056 {
00057 return TDataType(KExampleTextMimeType);
00058 }
00059
00060
00061
00062
00063 void CExampleNewRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer)
00064 {
00065 _LIT8(KExampleData, "example");
00066 _LIT(KDotExample, ".Example");
00067
00068 TParse parse;
00069 parse.Set(aName,NULL,NULL);
00070 TPtrC ext=parse.Ext();
00071
00072 if (ext.CompareF(KDotExample)==0 && aBuffer.FindF(KExampleData)!=KErrNotFound)
00073 {
00074 iConfidence=ECertain;
00075 iDataType=TDataType(KExampleTextMimeType);
00076 }
00077 }
00078
00079
00080
00081
00082 CApaDataRecognizerType* CExampleNewRecognizer::CreateRecognizerL()
00083 {
00084 return new (ELeave) CExampleNewRecognizer;
00085 }
00086
00087
00088
00089
00090 const TImplementationProxy ImplementationTable[] =
00091 {
00092 IMPLEMENTATION_PROXY_ENTRY(KImplementationUid,CExampleNewRecognizer::CreateRecognizerL)
00093 };
00094
00095
00096
00097
00098 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
00099 {
00100 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
00101 return ImplementationTable;
00102 }