localisation/apparchitecture/tef/TLongUrlRecognizer.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This recognizer is part of the supporting test code
       
    15 // for T_StartDocStep.CPP
       
    16 // This recognizer only exists to associate the document
       
    17 // name KLitLongURL (defined in TStartDoc.h) with the
       
    18 // TStartDocApp.app application.
       
    19 // This enables T_StartDocStep.CPP to launch TStartDocApp.app
       
    20 // by starting the document KLitLongURL.
       
    21 // 
       
    22 //
       
    23 
       
    24 
       
    25 
       
    26 /**
       
    27  @file
       
    28  @internalComponent - Internal Symbian test code
       
    29 */
       
    30 
       
    31 #include <E32STD.H>
       
    32 #include <E32BASE.H>
       
    33 #include <APMSTD.H>
       
    34 #include <APMREC.H>
       
    35 #include "TStartDoc.h"
       
    36 
       
    37 #include <apfrec.h>
       
    38 #include <ImplementationProxy.h> 
       
    39 
       
    40 
       
    41 const TUid KUidMimeLongURLRecognizer={0x10004c4e};
       
    42 const TInt KNumDataTypes = 1;
       
    43 _LIT8(KLitMimeType_LongURL, "x-epoc/long-url");
       
    44 
       
    45 // CLongUrlRec
       
    46 
       
    47 class CLongUrlRec : public CApaDataRecognizerType
       
    48 	{
       
    49 public:
       
    50 	CLongUrlRec();
       
    51 	static CApaDataRecognizerType* CreateRecognizerL();
       
    52 private:
       
    53 	// from CApaDataRecognizerType
       
    54 	virtual TUint PreferredBufSize();
       
    55 	virtual TDataType SupportedDataTypeL(TInt aIndex) const;
       
    56 	virtual void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
       
    57 	};
       
    58 
       
    59 CLongUrlRec::CLongUrlRec()
       
    60 	:CApaDataRecognizerType(KUidMimeLongURLRecognizer, EHigh)
       
    61 	{
       
    62 	iCountDataTypes=KNumDataTypes;
       
    63 	}
       
    64 
       
    65 TUint CLongUrlRec::PreferredBufSize()
       
    66 	{
       
    67 	return 0;
       
    68 	}
       
    69 
       
    70 TDataType CLongUrlRec::SupportedDataTypeL(TInt /*aIndex*/) const
       
    71 	{
       
    72 	return TDataType(KLitMimeType_LongURL);
       
    73 	}
       
    74 
       
    75 void CLongUrlRec::DoRecognizeL(const TDesC& aName, const TDesC8&)
       
    76 	{
       
    77 	if (aName==KLitLongURL)
       
    78 		{
       
    79 		iDataType=TDataType(KLitMimeType_LongURL); // TStartDocApp.app supports mime type KLitMimeType_LongURL
       
    80 		iConfidence=ECertain;
       
    81 		}
       
    82 	}
       
    83 
       
    84 // stand-alone functions
       
    85 
       
    86 
       
    87 GLDEF_C TInt E32Dll(
       
    88 					)
       
    89 	{
       
    90 	return KErrNone;
       
    91 	}
       
    92 	
       
    93 CApaDataRecognizerType* CLongUrlRec::CreateRecognizerL()
       
    94 	{
       
    95 	return new (ELeave) CLongUrlRec();
       
    96 	}
       
    97 
       
    98 const TImplementationProxy ImplementationTable[] = 
       
    99     {
       
   100 	IMPLEMENTATION_PROXY_ENTRY(0x101F7D8D,CLongUrlRec::CreateRecognizerL)
       
   101 	};
       
   102 
       
   103 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   104     {
       
   105     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   106     return ImplementationTable;
       
   107     }