diff -r 000000000000 -r 2e3d3ce01487 contenthandling/webrecognisers/weburlrec/weburlrec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contenthandling/webrecognisers/weburlrec/weburlrec.cpp Tue Feb 02 10:12:00 2010 +0200 @@ -0,0 +1,169 @@ +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// RECScheme.CPP +// +// + +#include +#include +#include +#include "weburlrec.h" + +#ifdef __UI_FRAMEWORKS_V2__ +#include +#endif //__UI_FRAMEWORKS_V2__ + +const TInt KMimeWebUrlRecognizerValue = 0x100064DE; +const TUid KUidWebUrlRecognizer = {KMimeWebUrlRecognizerValue}; +const TInt KSchemeNumMimeTypes = 6; // http, https, file, mailto, sms, mms are recognised by this plugin + +_LIT( KHttpScheme , "http" ); _LIT8( KHttpUrlDataType , "X-Epoc-Url/http" ) ; //may be either web or wap +_LIT( KHttpsScheme , "https" ); _LIT8( KHttpsUrlDataType , "X-Epoc-Url/https" ); //may be either web or wap +_LIT( KFileScheme , "file" ); _LIT8( KFileUrlDataType , "X-Epoc-Url/file" ); //may be either web or wap +//Messaging schemes +_LIT( KMailtoScheme , "mailto" ); _LIT8( KMailtoUrlDataType , "X-Epoc-Url/mailto" ); +_LIT( KSmsScheme , "sms" ); _LIT8( KSmsUrlDataType , "X-Epoc-Url/sms" ); +_LIT( KMmsScheme , "mms" ); _LIT8( KMmsUrlDataType , "X-Epoc-Url/mms" ); + +const TInt KWebUrlRecognizerStringLength = 255; + + +CApaSchemeRecognizer::CApaSchemeRecognizer() + :CApaDataRecognizerType(KUidWebUrlRecognizer,CApaDataRecognizerType::ENormal) + { + iConfidence = ENotRecognized; + iCountDataTypes = KSchemeNumMimeTypes; + } + +TUint CApaSchemeRecognizer::PreferredBufSize() + { + return KWebUrlRecognizerStringLength; + } + +TDataType CApaSchemeRecognizer::SupportedDataTypeL(TInt aIndex) const + // this is a special supported data type X-EPOC-Scheme for urls + { + __ASSERT_DEBUG(aIndex>=0 && aIndex= 0 && aScheme.Length() == colonPos) // we have found a scheme that is the bit before the ':' + { + return ETrue; + } + + return EFalse; + } + + +#ifdef __UI_FRAMEWORKS_V2__ + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x100064DE,CApaSchemeRecognizer::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +CApaDataRecognizerType* CApaSchemeRecognizer::NewL() + { + return new (ELeave) CApaSchemeRecognizer(); + } + +#else + +EXPORT_C CApaDataRecognizerType* CreateRecognizer() +// The gate function - ordinal 1 +// + { + CApaDataRecognizerType* thing = new CApaSchemeRecognizer(); + return thing; // NULL if new failed + } + +#endif //__UI_FRAMEWORKS_V2__ + + +#ifndef EKA2 +GLDEF_C TInt E32Dll(TDllReason /*aReason*/) +// +// DLL entry point +// + { + return KErrNone; + } +#endif // EKA2