|
1 // Copyright (c) 1997-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 #ifndef __ImageConvResolvrUtils_h |
|
17 #define __ImageConvResolvrUtils_h |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 #include "ImageConversion.h" |
|
22 |
|
23 const TInt KIclPluginFrameworkVersionZero = 0; // no flags |
|
24 const TInt KIclPluginFrameworkVersionOne = 1; // with flags |
|
25 const TInt KIclPluginFrameworkVersionTwo = 2; // with flags |
|
26 const TInt KIclPluginFrameworkVersionMax = 2; // max "legal" version |
|
27 |
|
28 const TInt KIndexForVersion = 0; // index in opaque data for the version |
|
29 const TInt KIndexForFlags = 1; // index for flags in opaque data |
|
30 |
|
31 class COpaqueDataParse; // declared here |
|
32 NONSHARABLE_CLASS( COpaqueDataParse ): public CBase |
|
33 { |
|
34 public: |
|
35 static COpaqueDataParse* NewL(const TDesC8& aOpaqueData); |
|
36 static COpaqueDataParse* NewLC(const TDesC8& aOpaqueData); |
|
37 ~COpaqueDataParse(); |
|
38 TBool OnlyUidsAvail() const; |
|
39 TBool IsSubCodec() const; |
|
40 TBool IsOpenNeededToRecognize() const; |
|
41 TBool IsOpenAgainstSuffix() const; |
|
42 TBool IsRecognizeAgainstSuffix() const; |
|
43 void EnsureExtnsReadL(); |
|
44 void EnsureMIMETypesReadL(); |
|
45 void EnsureBinaryPropertiesReadL(); |
|
46 TInt BinaryPropertiesCount() const; |
|
47 TInt ExtnsCount() const; |
|
48 TInt MIMETypesCount() const; |
|
49 void GetBinaryPropertiesArrayL(RUidDataArray& aBinaryPropertiesArray) const; |
|
50 const TDesC8& Extn (TInt aIndex) const; |
|
51 const TDesC8& MIMEType (TInt aIndex) const; |
|
52 TInt Version() const; |
|
53 TInt Flags() const; |
|
54 TUid ImageTypeUid() const; |
|
55 TUid ImageSubTypeUid() const; |
|
56 TUid PluginClassUid() const; |
|
57 TBool CompareUids(COpaqueDataParse* aParse) const; |
|
58 TBool CompareUids(TUid aType, TUid aSubType = KNullUid) const; |
|
59 static TBool CompareMIMETypes(const TDesC8& aMimeType1, const TDesC8& aMimeType2); |
|
60 static TBool CompareFileSuffixL(const TDesC& aFileSuffix1, const TDesC8& aFileSuffix2); |
|
61 TBool CheckRequiredUids(const RUidDataArray& aRequiredUids); |
|
62 TBool CheckOptionsUids(const RUidDataArray& aOptionsUids); |
|
63 TBool IsDefaultCodec() const; |
|
64 TBool SupportsExtensionsL(TUint aRequiredExtensions); |
|
65 |
|
66 protected: |
|
67 COpaqueDataParse(const TDesC8& aOpaqueData); |
|
68 void ConstructL(); |
|
69 void ReadVersion(); |
|
70 void ReadFlags(); |
|
71 void ReadUids(); |
|
72 |
|
73 private: |
|
74 enum TProcessState |
|
75 { |
|
76 EVersionProcessed, |
|
77 EFlagsProcessed, |
|
78 EUidsProcessed, |
|
79 EExtnsProcessed, |
|
80 EMIMETypesProcessed, |
|
81 EBinPropertiesProcessed |
|
82 }; |
|
83 |
|
84 enum TPluginFlags |
|
85 { |
|
86 ESubCodec = 0x00000001, |
|
87 EOpenNeededToRecognize = 0x00000002, |
|
88 EOpenAgainstSuffix = 0x00000004, |
|
89 ERecognizeAgainstSuffix = 0x00000008 |
|
90 }; |
|
91 |
|
92 const TDesC8& iOpaqueData; |
|
93 TProcessState iState; |
|
94 TInt iVersion; |
|
95 TInt iFlags; |
|
96 TUid iImageTypeUid; |
|
97 TUid iImageSubTypeUid; |
|
98 TUid iPluginClassUid; |
|
99 TInt iExtnCount; |
|
100 |
|
101 TInt iLenOfFlags; // len of flag field (0 or 2) |
|
102 TInt iLenOfUids; // len of UIDs field |
|
103 TInt iStartOfUids; // index for uids in opaque data |
|
104 TInt iStartOfNumberOfExtns; // index in Opaque data for the number of extensions |
|
105 TInt iStartOfMimeTypes; |
|
106 TInt iStartOfNumberOfBinProperties; // Index in opaque data for the number of binary properties |
|
107 |
|
108 RArray<TPtrC8> iArray; |
|
109 RUidDataArray iBinaryPropertiesArray; |
|
110 }; |
|
111 |
|
112 // Utility class used in ImageConversionResolver.dll |
|
113 // and ImageConversion.dll. |
|
114 // Searches for a match of aClientString in aPluginString |
|
115 // - aPluginString is normally from CImplementationInformation::DataType() |
|
116 class CImageConversionResolverUtils : public CBase |
|
117 { |
|
118 public: |
|
119 static TBool Match(const TDesC8& aClientString, const TDesC8& aPluginString, TInt& aBytesMatched); |
|
120 }; |
|
121 |
|
122 #include "ImageConvResolvrUtils.inl" |
|
123 |
|
124 #endif // __ImageConvResolvrUtils_h |