sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "RecMmfUtilBody.h" sl@0: sl@0: sl@0: /** sl@0: * @internalAll sl@0: * sl@0: * constructor for MMF Recognizer utility class sl@0: */ sl@0: CMmfRecognizerUtil::CMmfRecognizerUtil() sl@0: { sl@0: } sl@0: sl@0: CMmfRecognizerUtil::~CMmfRecognizerUtil() sl@0: { sl@0: delete iBody; sl@0: } sl@0: sl@0: void CMmfRecognizerUtil::ConstructL() sl@0: { sl@0: iBody = CMmfRecognizerUtil::CBody::NewL(); sl@0: } sl@0: sl@0: /** sl@0: * @internalAll sl@0: * sl@0: * Determine whether the supplied data header on its own is recognized, sl@0: * or the data header plus the file suffix together are recognized, sl@0: * and if so return the associated MIME type. sl@0: * sl@0: * @param aFileName sl@0: * The name of the file sl@0: * @param aImageData sl@0: * A descriptor containing the header sl@0: * @param aMimeType sl@0: * A user-supplied descriptor in which the MIME type is returned sl@0: * @leave KErrUnderflow sl@0: * Not enough data in descriptor to identify whether it is supported sl@0: * by any plugin. sl@0: * @leave This method may also leave with one of the system-wide error codes. sl@0: * @return EMatchNone if a match was not found. sl@0: * EMatchData if a data match was found. sl@0: * EMatchName if a data and file suffix match was found. sl@0: * @post If recognized, the caller's descriptor is filled with the MIME types sl@0: */ sl@0: EXPORT_C CMmfRecognizerUtil::TMatchLevel CMmfRecognizerUtil::GetMimeTypeL(const TDesC& aFileName, const TDesC8& aImageData, TDes8& aMimeType) sl@0: { sl@0: return iBody->GetMimeTypeL(aFileName, aImageData, aMimeType); sl@0: } sl@0: sl@0: /** sl@0: * @internalAll sl@0: * sl@0: * Static factory constructor. Uses two phase sl@0: * construction and leaves nothing on the cleanup stack sl@0: * sl@0: * @leave KErrNoMemory sl@0: * @return A pointer to the newly created CMmfRecognizerUtil object sl@0: * sl@0: */ sl@0: EXPORT_C CMmfRecognizerUtil* CMmfRecognizerUtil::NewL() sl@0: { sl@0: CMmfRecognizerUtil* self=new (ELeave) CMmfRecognizerUtil(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: * @internalAll sl@0: * sl@0: * Get all the mime types supported by MMF sl@0: * @param aMimeTypes sl@0: * A caller-supplied array of descriptors. sl@0: * @leave This method may leave with one of the system-wide error codes. sl@0: * @post The caller's array is filled with the supported MIME types sl@0: */ sl@0: EXPORT_C void CMmfRecognizerUtil::GetMimeTypesL(CDesC8Array* aMimeTypes) sl@0: { sl@0: CMmfRecognizerUtil::CBody::GetMimeTypesL(aMimeTypes); sl@0: } sl@0: