os/mm/mmlibs/mmfw/src/ControllerFramework/RecMmfUtil.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "RecMmfUtilBody.h"
sl@0
    17
sl@0
    18
sl@0
    19
/**
sl@0
    20
 * @internalAll
sl@0
    21
 *
sl@0
    22
 * constructor for MMF Recognizer utility class
sl@0
    23
 */
sl@0
    24
CMmfRecognizerUtil::CMmfRecognizerUtil()
sl@0
    25
	{
sl@0
    26
	}
sl@0
    27
sl@0
    28
CMmfRecognizerUtil::~CMmfRecognizerUtil()
sl@0
    29
	{
sl@0
    30
	delete iBody;
sl@0
    31
	}
sl@0
    32
sl@0
    33
void CMmfRecognizerUtil::ConstructL()
sl@0
    34
	{
sl@0
    35
	iBody = CMmfRecognizerUtil::CBody::NewL();
sl@0
    36
	}
sl@0
    37
sl@0
    38
/**
sl@0
    39
 * @internalAll
sl@0
    40
 *
sl@0
    41
 * Determine whether the supplied data header on its own is recognized,
sl@0
    42
 * or the data header plus the file suffix together are recognized,
sl@0
    43
 * and if so return the associated MIME type.
sl@0
    44
 *
sl@0
    45
 * @param	aFileName
sl@0
    46
 *			The name of the file
sl@0
    47
 * @param	aImageData
sl@0
    48
 *          A descriptor containing the header
sl@0
    49
 * @param   aMimeType
sl@0
    50
 *          A user-supplied descriptor in which the MIME type is returned
sl@0
    51
 * @leave   KErrUnderflow 
sl@0
    52
 *			Not enough data in descriptor to identify whether it is supported
sl@0
    53
 *          by any plugin.
sl@0
    54
 * @leave	This method may also leave with one of the system-wide error codes.
sl@0
    55
 * @return  EMatchNone if a match was not found.
sl@0
    56
 *			EMatchData if a data match was found.
sl@0
    57
 *			EMatchName if a data and file suffix match was found.
sl@0
    58
 * @post    If recognized, the caller's descriptor is filled with the MIME types
sl@0
    59
 */
sl@0
    60
EXPORT_C CMmfRecognizerUtil::TMatchLevel CMmfRecognizerUtil::GetMimeTypeL(const TDesC& aFileName, const TDesC8& aImageData, TDes8& aMimeType)
sl@0
    61
	{
sl@0
    62
	return iBody->GetMimeTypeL(aFileName, aImageData, aMimeType);
sl@0
    63
	}
sl@0
    64
sl@0
    65
/**
sl@0
    66
 * @internalAll
sl@0
    67
 *
sl@0
    68
 * Static factory constructor. Uses two phase
sl@0
    69
 * construction and leaves nothing on the cleanup stack
sl@0
    70
 *
sl@0
    71
 * @leave KErrNoMemory
sl@0
    72
 * @return A pointer to the newly created CMmfRecognizerUtil object
sl@0
    73
 *
sl@0
    74
 */
sl@0
    75
EXPORT_C CMmfRecognizerUtil* CMmfRecognizerUtil::NewL()
sl@0
    76
	{
sl@0
    77
	CMmfRecognizerUtil* self=new (ELeave) CMmfRecognizerUtil();   
sl@0
    78
	CleanupStack::PushL(self);
sl@0
    79
	self->ConstructL();
sl@0
    80
	CleanupStack::Pop(self);
sl@0
    81
	return self;
sl@0
    82
	}
sl@0
    83
sl@0
    84
/**
sl@0
    85
 * @internalAll
sl@0
    86
 *
sl@0
    87
 * Get all the mime types supported by MMF
sl@0
    88
 * @param	aMimeTypes
sl@0
    89
 *          A caller-supplied array of descriptors.
sl@0
    90
 * @leave	This method may leave with one of the system-wide error codes.
sl@0
    91
 * @post    The caller's array is filled with the supported MIME types
sl@0
    92
 */
sl@0
    93
EXPORT_C void CMmfRecognizerUtil::GetMimeTypesL(CDesC8Array* aMimeTypes)
sl@0
    94
	{
sl@0
    95
	CMmfRecognizerUtil::CBody::GetMimeTypesL(aMimeTypes);
sl@0
    96
	}
sl@0
    97