imagingandcamerafws/imagingfws/ImageDisplay/src/Resolver/ImageDisplayResolvrUtils.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2004-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 __IMAGEDISPLAYRESOLVRUTILS_H__
       
    17 #define __IMAGEDISPLAYRESOLVRUTILS_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 /** @file
       
    22 	@internalComponent */
       
    23 
       
    24 const TInt KIclPluginFrameworkVersionOne = 1;	// default resource format version number
       
    25 const TInt KIclPluginFrameworkVersionMax = 1;	// current max "legal" version
       
    26 
       
    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 : public CBase
       
    32 	{
       
    33 public:
       
    34 	static COpaqueDataParse* NewL(const TDesC8& aOpaqueData);
       
    35 	static COpaqueDataParse* NewLC(const TDesC8& aOpaqueData);
       
    36 	~COpaqueDataParse();
       
    37 	TBool OnlyUidsAvail() const;
       
    38 	TBool IsOpenAgainstSuffix() const;
       
    39 	TBool IsSetSourceRectSupported() const;
       
    40 
       
    41 	void EnsureExtnsReadL();
       
    42 	void EnsureMIMETypesReadL();
       
    43 	TInt ExtnsCount() const;
       
    44 	TInt MIMETypesCount() const;
       
    45 	const TDesC8& Extn (TInt aIndex) const;
       
    46 	const TDesC8& MIMEType (TInt aIndex) const;
       
    47 	TInt Version() const;
       
    48 	TInt Flags() const;
       
    49 	TUid ImageTypeUid() const;
       
    50 	TUid ImageSubTypeUid() const;
       
    51 	TBool CompareUids(COpaqueDataParse* aParse) const;
       
    52 	TBool CompareUids(TUid aType, TUid aSubType = KNullUid) const;
       
    53 	static TBool CompareMIMETypes(const TDesC8& aMimeType1, const TDesC8& aMimeType2);
       
    54 	static TBool CompareFileSuffixL(const TDesC& aFileSuffix1, const TDesC8& aFileSuffix2);
       
    55 protected:
       
    56 	COpaqueDataParse(const TDesC8& aOpaqueData);
       
    57 	void ConstructL();
       
    58 	void ReadVersion();
       
    59 	void ReadFlags();
       
    60 	void ReadUids();
       
    61 private:
       
    62 	enum TProcessState
       
    63 		{
       
    64 		EVersionProcessed,
       
    65 		EFlagsProcessed,
       
    66 		EUidsProcessed,
       
    67 		EExtnsProcessed,
       
    68 		EMIMETypesProcessed
       
    69 		};
       
    70 	enum TPluginFlags
       
    71 		{
       
    72 		EOpenAgainstSuffix		= 0x00000001,
       
    73 		ESetSourceRectSupported = 0x00000002
       
    74 		};
       
    75 
       
    76 	const TDesC8& iOpaqueData;
       
    77 	TProcessState iState;
       
    78 	TInt iVersion;
       
    79 	TInt iFlags;
       
    80 	TUid iImageTypeUid;
       
    81 	TUid iImageSubTypeUid;
       
    82 	TInt iExtnCount;
       
    83 
       
    84 	TInt iLenOfFlags;				// len of flag field (0 or 2)
       
    85 	TInt iStartOfUids;				// index for uids in opaque data
       
    86 	TInt iStartOfNumberOfExtns;		// index in Opaque data for the number of extensions
       
    87 	
       
    88 	TInt iStartOfMimeTypes;
       
    89 	
       
    90 	RArray<TPtrC8> iArray;
       
    91 	};
       
    92 
       
    93 // Utility class used in ImageDisplayResolver.dll
       
    94 // and ImageDisplay.dll.
       
    95 // Searches for a match of aClientString in aPluginString
       
    96 // - aPluginString is normally from CImplementationInformation::DataType()
       
    97 class CImageDisplayResolverUtils : public CBase
       
    98 	{
       
    99 public:
       
   100 	static TBool Match(const TDesC8& aClientString, const TDesC8& aPluginString, TInt& aBytesMatched);
       
   101 	};
       
   102 
       
   103 #include "ImageDisplayResolvrUtils.inl"
       
   104 
       
   105 #endif  // __IMAGEDISPLAYRESOLVRUTILS_H__