installationservices/swi/inc/swi/swtypereginfo.h
branchRCL_3
changeset 25 7333d7932ef7
parent 0 ba25891c3a9e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    27 #define SWTYPEREGINFO_H
    27 #define SWTYPEREGINFO_H
    28 
    28 
    29 #include <e32base.h>
    29 #include <e32base.h>
    30 #include <s32mem.h>
    30 #include <s32mem.h>
    31 #include <ct/rcpointerarray.h>
    31 #include <ct/rcpointerarray.h>
       
    32 #include <usif/scr/screntries_platform.h>
    32 
    33 
    33 namespace Swi
    34 namespace Swi
    34 	{
    35 	{
    35 	_LIT(KTxtSoftwareTypeComponentProperty, "softwareTypes");
    36 	_LIT(KTxtSoftwareTypeComponentProperty, "softwareTypes");
    36 
    37 
    37 	class CLocalizedSoftwareTypeName : public CBase
       
    38 		{
       
    39 	public:
       
    40 		IMPORT_C static CLocalizedSoftwareTypeName* NewL(const TDesC& aName, TLanguage aLocale);
       
    41 		IMPORT_C static CLocalizedSoftwareTypeName* NewLC(const TDesC& aName, TLanguage aLocale);
       
    42 		IMPORT_C static CLocalizedSoftwareTypeName* NewL(RReadStream& aStream);
       
    43 		
       
    44 		IMPORT_C virtual ~CLocalizedSoftwareTypeName();
       
    45 		
       
    46 		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
    47 		
       
    48 		inline const TDesC& Name() const;
       
    49 		inline TLanguage Locale() const;
       
    50 		
       
    51 	private:
       
    52 		CLocalizedSoftwareTypeName();
       
    53 		CLocalizedSoftwareTypeName(TLanguage aLocale);
       
    54 
       
    55 		void InternalizeL(RReadStream& aStream);
       
    56 		
       
    57 	private:
       
    58 		HBufC* iName;
       
    59 		TLanguage iLocale;
       
    60 		};
       
    61 
       
    62 // ##########################################################################################
       
    63 
       
    64 	class CSoftwareTypeRegInfo : public CBase
       
    65 		{
       
    66 	public:
       
    67 		IMPORT_C static CSoftwareTypeRegInfo* NewL(const TDesC& aUniqueSoftwareTypeName);
       
    68 		IMPORT_C static CSoftwareTypeRegInfo* NewL(RReadStream& aStream);
       
    69 
       
    70 		IMPORT_C virtual ~CSoftwareTypeRegInfo();
       
    71 		
       
    72 		IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
    73 		IMPORT_C TInt ExternalizedSize() const;
       
    74 
       
    75 		inline void SetSifPluginUid(TUid aUid);
       
    76 		inline void SetInstallerSecureId(TSecureId aSecureId);
       
    77 		inline void SetExecutionLayerSecureId(TSecureId aSecureId);
       
    78 		IMPORT_C void SetMimeTypeL(const TDesC& aMimeType);
       
    79 		IMPORT_C void SetLocalizedSoftwareTypeNameL(TLanguage aLanguage, const TDesC& aName);
       
    80 
       
    81 		inline const TDesC& UniqueSoftwareTypeName() const;
       
    82 		inline TUid SifPluginUid() const;
       
    83 		inline TSecureId InstallerSecureId() const;
       
    84 		inline TSecureId ExecutionLayerSecureId() const;
       
    85 		inline const RPointerArray<HBufC>& MimeTypes() const;
       
    86 		inline const RPointerArray<CLocalizedSoftwareTypeName>& LocalizedSoftwareTypeNames() const;
       
    87 
       
    88 	private:
       
    89 		CSoftwareTypeRegInfo();
       
    90 		void InternalizeL(RReadStream& aStream);
       
    91 
       
    92 		enum { EUniqueSwTypeNameMaxLength = 32 }; 
       
    93 
       
    94 		HBufC* iUniqueSoftwareTypeName;
       
    95 		TUid iSifPluginUid;
       
    96 		TSecureId iInstallerSecureId;
       
    97 		TSecureId iExecutionLayerSecureId;
       
    98 		RCPointerArray<HBufC> iMimeTypes;
       
    99 		RCPointerArray<CLocalizedSoftwareTypeName> iLocalizedSoftwareTypeNames;
       
   100 		};
       
   101 
       
   102 // ##########################################################################################
       
   103 
       
   104 	class SoftwareTypeRegInfoUtils
    38 	class SoftwareTypeRegInfoUtils
   105 		{
    39 		{
   106 	public:
    40 	public:
   107 		IMPORT_C static void SerializeArrayL(const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RBuf8& aSerializedArray);
    41 		IMPORT_C static void SerializeArrayL(const RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RBuf8& aSerializedArray);
   108 		IMPORT_C static void UnserializeArrayL(RReadStream& aStream, RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray);
    42 		IMPORT_C static void UnserializeArrayL(RReadStream& aStream, RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray);
   109 		IMPORT_C static void SerializeUniqueSwTypeNamesL(const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RBuf& aSerializedNames);
    43 		IMPORT_C static void SerializeUniqueSwTypeNamesL(const RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RBuf& aSerializedNames);
   110 		IMPORT_C static void UnserializeUniqueSwTypeNamesL(const TDesC& aSerializedNames, RArray<TPtrC>& aUniqueSwTypeNames);
    44 		IMPORT_C static void UnserializeUniqueSwTypeNamesL(const TDesC& aSerializedNames, RArray<TPtrC>& aUniqueSwTypeNames);
   111 		IMPORT_C static void ExtractMimeTypesL(const RPointerArray<CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RPointerArray<HBufC8>& aMimeTypes);
    45 		IMPORT_C static void ExtractMimeTypesL(const RPointerArray<Usif::CSoftwareTypeRegInfo>& aSwTypeRegInfoArray, RPointerArray<HBufC8>& aMimeTypes);
   112 	public:
    46 	public:
   113 		enum { KUniqueNameSeparator = 0x1E };  // 'record separator'
    47 		enum { KUniqueNameSeparator = 0x1E };  // 'record separator'
   114 		};
    48 		};
   115 
       
   116 // ##########################################################################################
       
   117 
       
   118 	inline const TDesC& CLocalizedSoftwareTypeName::Name() const
       
   119 		{
       
   120 		return *iName;
       
   121 		}
       
   122 
       
   123 	inline TLanguage CLocalizedSoftwareTypeName::Locale() const
       
   124 		{
       
   125 		return iLocale;
       
   126 		}
       
   127 
       
   128 // ##########################################################################################
       
   129 
       
   130 	inline void CSoftwareTypeRegInfo::SetSifPluginUid(TUid aUid)
       
   131 		{
       
   132 		iSifPluginUid = aUid;
       
   133 		}
       
   134 
       
   135 	inline void CSoftwareTypeRegInfo::SetInstallerSecureId(TSecureId aSecureId)
       
   136 		{
       
   137 		iInstallerSecureId = aSecureId;
       
   138 		}
       
   139 
       
   140 	inline void CSoftwareTypeRegInfo::SetExecutionLayerSecureId(TSecureId aSecureId)
       
   141 		{
       
   142 		iExecutionLayerSecureId = aSecureId;
       
   143 		}
       
   144 
       
   145 	inline const TDesC& CSoftwareTypeRegInfo::UniqueSoftwareTypeName() const
       
   146 		{
       
   147 		if (iUniqueSoftwareTypeName == NULL)
       
   148 			{
       
   149 			return KNullDesC;
       
   150 			}
       
   151 		return *iUniqueSoftwareTypeName;
       
   152 		}
       
   153 
       
   154 	inline TUid CSoftwareTypeRegInfo::SifPluginUid() const
       
   155 		{
       
   156 		return iSifPluginUid;
       
   157 		}
       
   158 
       
   159 	TSecureId CSoftwareTypeRegInfo::InstallerSecureId() const
       
   160 		{
       
   161 		return iInstallerSecureId;
       
   162 		}
       
   163 
       
   164 	TSecureId CSoftwareTypeRegInfo::ExecutionLayerSecureId() const
       
   165 		{
       
   166 		return iInstallerSecureId;
       
   167 		}
       
   168 
       
   169 	const RPointerArray<HBufC>& CSoftwareTypeRegInfo::MimeTypes() const
       
   170 		{
       
   171 		return iMimeTypes;
       
   172 		}
       
   173 
       
   174 	const RPointerArray<CLocalizedSoftwareTypeName>& CSoftwareTypeRegInfo::LocalizedSoftwareTypeNames() const
       
   175 		{
       
   176 		return iLocalizedSoftwareTypeNames;
       
   177 		}
       
   178 	}
    49 	}
   179 
    50 
   180 #endif // SWTYPEREGINFO_H
    51 #endif // SWTYPEREGINFO_H