appfw/apparchitecture/tef/TLongUrlRecognizer.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-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  @file
       
    26  @internalComponent - Internal Symbian test code
       
    27 */
       
    28 
       
    29 #include <e32std.h>
       
    30 #include <e32base.h>
       
    31 #include <apmstd.h>
       
    32 #include <apmrec.h>
       
    33 #include "TStartDoc.h"
       
    34 
       
    35 #include <apfrec.h>
       
    36 #include <ecom/implementationproxy.h> 
       
    37 
       
    38 
       
    39 const TUid KUidMimeLongURLRecognizer={0x10004c4e};
       
    40 const TInt KNumDataTypes = 1;
       
    41 _LIT8(KLitMimeType_LongURL, "x-epoc/long-url");
       
    42 
       
    43 // CLongUrlRec
       
    44 
       
    45 class CLongUrlRec : public CApaDataRecognizerType
       
    46 	{
       
    47 public:
       
    48 	CLongUrlRec();
       
    49 	static CApaDataRecognizerType* CreateRecognizerL();
       
    50 private:
       
    51 	// from CApaDataRecognizerType
       
    52 	virtual TUint PreferredBufSize();
       
    53 	virtual TDataType SupportedDataTypeL(TInt aIndex) const;
       
    54 	virtual void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer);
       
    55 	};
       
    56 
       
    57 CLongUrlRec::CLongUrlRec()
       
    58 	:CApaDataRecognizerType(KUidMimeLongURLRecognizer, EHigh)
       
    59 	{
       
    60 	iCountDataTypes=KNumDataTypes;
       
    61 	}
       
    62 
       
    63 TUint CLongUrlRec::PreferredBufSize()
       
    64 	{
       
    65 	return 0;
       
    66 	}
       
    67 
       
    68 TDataType CLongUrlRec::SupportedDataTypeL(TInt /*aIndex*/) const
       
    69 	{
       
    70 	return TDataType(KLitMimeType_LongURL);
       
    71 	}
       
    72 
       
    73 void CLongUrlRec::DoRecognizeL(const TDesC& aName, const TDesC8&)
       
    74 	{
       
    75 	if (aName==KLitLongURL)
       
    76 		{
       
    77 		iDataType=TDataType(KLitMimeType_LongURL); // TStartDocApp.app supports mime type KLitMimeType_LongURL
       
    78 		iConfidence=ECertain;
       
    79 		}
       
    80 	}
       
    81 
       
    82 // stand-alone functions
       
    83 
       
    84 
       
    85 GLDEF_C TInt E32Dll(
       
    86 					)
       
    87 	{
       
    88 	return KErrNone;
       
    89 	}
       
    90 	
       
    91 CApaDataRecognizerType* CLongUrlRec::CreateRecognizerL()
       
    92 	{
       
    93 	return new (ELeave) CLongUrlRec();
       
    94 	}
       
    95 
       
    96 const TImplementationProxy ImplementationTable[] = 
       
    97     {
       
    98 	IMPLEMENTATION_PROXY_ENTRY(0x101F7D8D,CLongUrlRec::CreateRecognizerL)
       
    99 	};
       
   100 
       
   101 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   102     {
       
   103     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   104     return ImplementationTable;
       
   105     }
       
   106