|
1 // Copyright (c) 2003-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 // |
|
15 |
|
16 #include "RecMmfUtilBody.h" |
|
17 |
|
18 |
|
19 /** |
|
20 * @internalAll |
|
21 * |
|
22 * constructor for MMF Recognizer utility class |
|
23 */ |
|
24 CMmfRecognizerUtil::CMmfRecognizerUtil() |
|
25 { |
|
26 } |
|
27 |
|
28 CMmfRecognizerUtil::~CMmfRecognizerUtil() |
|
29 { |
|
30 delete iBody; |
|
31 } |
|
32 |
|
33 void CMmfRecognizerUtil::ConstructL() |
|
34 { |
|
35 iBody = CMmfRecognizerUtil::CBody::NewL(); |
|
36 } |
|
37 |
|
38 /** |
|
39 * @internalAll |
|
40 * |
|
41 * Determine whether the supplied data header on its own is recognized, |
|
42 * or the data header plus the file suffix together are recognized, |
|
43 * and if so return the associated MIME type. |
|
44 * |
|
45 * @param aFileName |
|
46 * The name of the file |
|
47 * @param aImageData |
|
48 * A descriptor containing the header |
|
49 * @param aMimeType |
|
50 * A user-supplied descriptor in which the MIME type is returned |
|
51 * @leave KErrUnderflow |
|
52 * Not enough data in descriptor to identify whether it is supported |
|
53 * by any plugin. |
|
54 * @leave This method may also leave with one of the system-wide error codes. |
|
55 * @return EMatchNone if a match was not found. |
|
56 * EMatchData if a data match was found. |
|
57 * EMatchName if a data and file suffix match was found. |
|
58 * @post If recognized, the caller's descriptor is filled with the MIME types |
|
59 */ |
|
60 EXPORT_C CMmfRecognizerUtil::TMatchLevel CMmfRecognizerUtil::GetMimeTypeL(const TDesC& aFileName, const TDesC8& aImageData, TDes8& aMimeType) |
|
61 { |
|
62 return iBody->GetMimeTypeL(aFileName, aImageData, aMimeType); |
|
63 } |
|
64 |
|
65 /** |
|
66 * @internalAll |
|
67 * |
|
68 * Static factory constructor. Uses two phase |
|
69 * construction and leaves nothing on the cleanup stack |
|
70 * |
|
71 * @leave KErrNoMemory |
|
72 * @return A pointer to the newly created CMmfRecognizerUtil object |
|
73 * |
|
74 */ |
|
75 EXPORT_C CMmfRecognizerUtil* CMmfRecognizerUtil::NewL() |
|
76 { |
|
77 CMmfRecognizerUtil* self=new (ELeave) CMmfRecognizerUtil(); |
|
78 CleanupStack::PushL(self); |
|
79 self->ConstructL(); |
|
80 CleanupStack::Pop(self); |
|
81 return self; |
|
82 } |
|
83 |
|
84 /** |
|
85 * @internalAll |
|
86 * |
|
87 * Get all the mime types supported by MMF |
|
88 * @param aMimeTypes |
|
89 * A caller-supplied array of descriptors. |
|
90 * @leave This method may leave with one of the system-wide error codes. |
|
91 * @post The caller's array is filled with the supported MIME types |
|
92 */ |
|
93 EXPORT_C void CMmfRecognizerUtil::GetMimeTypesL(CDesC8Array* aMimeTypes) |
|
94 { |
|
95 CMmfRecognizerUtil::CBody::GetMimeTypesL(aMimeTypes); |
|
96 } |
|
97 |