os/mm/mmlibs/mmfw/src/ControllerFramework/RecMmfUtil.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/src/ControllerFramework/RecMmfUtil.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,97 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "RecMmfUtilBody.h"
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + * @internalAll
    1.24 + *
    1.25 + * constructor for MMF Recognizer utility class
    1.26 + */
    1.27 +CMmfRecognizerUtil::CMmfRecognizerUtil()
    1.28 +	{
    1.29 +	}
    1.30 +
    1.31 +CMmfRecognizerUtil::~CMmfRecognizerUtil()
    1.32 +	{
    1.33 +	delete iBody;
    1.34 +	}
    1.35 +
    1.36 +void CMmfRecognizerUtil::ConstructL()
    1.37 +	{
    1.38 +	iBody = CMmfRecognizerUtil::CBody::NewL();
    1.39 +	}
    1.40 +
    1.41 +/**
    1.42 + * @internalAll
    1.43 + *
    1.44 + * Determine whether the supplied data header on its own is recognized,
    1.45 + * or the data header plus the file suffix together are recognized,
    1.46 + * and if so return the associated MIME type.
    1.47 + *
    1.48 + * @param	aFileName
    1.49 + *			The name of the file
    1.50 + * @param	aImageData
    1.51 + *          A descriptor containing the header
    1.52 + * @param   aMimeType
    1.53 + *          A user-supplied descriptor in which the MIME type is returned
    1.54 + * @leave   KErrUnderflow 
    1.55 + *			Not enough data in descriptor to identify whether it is supported
    1.56 + *          by any plugin.
    1.57 + * @leave	This method may also leave with one of the system-wide error codes.
    1.58 + * @return  EMatchNone if a match was not found.
    1.59 + *			EMatchData if a data match was found.
    1.60 + *			EMatchName if a data and file suffix match was found.
    1.61 + * @post    If recognized, the caller's descriptor is filled with the MIME types
    1.62 + */
    1.63 +EXPORT_C CMmfRecognizerUtil::TMatchLevel CMmfRecognizerUtil::GetMimeTypeL(const TDesC& aFileName, const TDesC8& aImageData, TDes8& aMimeType)
    1.64 +	{
    1.65 +	return iBody->GetMimeTypeL(aFileName, aImageData, aMimeType);
    1.66 +	}
    1.67 +
    1.68 +/**
    1.69 + * @internalAll
    1.70 + *
    1.71 + * Static factory constructor. Uses two phase
    1.72 + * construction and leaves nothing on the cleanup stack
    1.73 + *
    1.74 + * @leave KErrNoMemory
    1.75 + * @return A pointer to the newly created CMmfRecognizerUtil object
    1.76 + *
    1.77 + */
    1.78 +EXPORT_C CMmfRecognizerUtil* CMmfRecognizerUtil::NewL()
    1.79 +	{
    1.80 +	CMmfRecognizerUtil* self=new (ELeave) CMmfRecognizerUtil();   
    1.81 +	CleanupStack::PushL(self);
    1.82 +	self->ConstructL();
    1.83 +	CleanupStack::Pop(self);
    1.84 +	return self;
    1.85 +	}
    1.86 +
    1.87 +/**
    1.88 + * @internalAll
    1.89 + *
    1.90 + * Get all the mime types supported by MMF
    1.91 + * @param	aMimeTypes
    1.92 + *          A caller-supplied array of descriptors.
    1.93 + * @leave	This method may leave with one of the system-wide error codes.
    1.94 + * @post    The caller's array is filled with the supported MIME types
    1.95 + */
    1.96 +EXPORT_C void CMmfRecognizerUtil::GetMimeTypesL(CDesC8Array* aMimeTypes)
    1.97 +	{
    1.98 +	CMmfRecognizerUtil::CBody::GetMimeTypesL(aMimeTypes);
    1.99 +	}
   1.100 +