|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * ScrHelperUtil interface definition |
|
16 * Helps the other classes on retrieving the SCR properties. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @released |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef __SCRHELPERUTIL_H__ |
|
29 #define __SCRHELPERUTIL_H__ |
|
30 |
|
31 #include <e32base.h> |
|
32 #include <usif/scr/scr.h> |
|
33 #include "../inc/swi/installtypes.h" |
|
34 |
|
35 namespace Swi |
|
36 { |
|
37 |
|
38 class CSisRegistryObject; |
|
39 class CControllerInfo; |
|
40 class CHashContainer; |
|
41 class CSisRegistryToken; |
|
42 class CSisRegistryPackage; |
|
43 class CSisRegistryDependency; |
|
44 class CSisRegistryProperty; |
|
45 class CSisRegistryFileDescription; |
|
46 class TSisTrustStatus; |
|
47 class CLogEntry; |
|
48 |
|
49 namespace ScrHelperUtil |
|
50 { |
|
51 // Set of over loaded methods used to write the corresponding objects in to SCR and |
|
52 // to retrieve the same objects back from the SCR. |
|
53 // All these overloaded methods are friends to the corresponding classes. |
|
54 void AddComponentL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::TComponentId& aCompId, CSisRegistryObject& aObject, Usif::TScrComponentOperationType aOpType); |
|
55 void GetComponentL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryObject& aObject); |
|
56 void GetComponentLocalizedInfoL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryObject& aObject); |
|
57 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::TComponentId& aCompId, CSisRegistryToken& aToken); |
|
58 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::CComponentEntry* aComponentEntry, CSisRegistryToken& aToken, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
59 |
|
60 // As the below set of 11 methods are declared as friend in published partner classes, |
|
61 // just to avoid unnecessary export of this header file, they all forward declared in |
|
62 // their corresponding header files. |
|
63 // So, the changes done to these set of methods should be reflected there too. *- Otherwise it may result in run time problems -*. |
|
64 |
|
65 // Published partner friends set begin |
|
66 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::TComponentId& aCompId, CSisRegistryPackage& aPackage); |
|
67 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::CComponentEntry* aComponentEntry, CSisRegistryPackage& aPackage); |
|
68 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aEmbeddedCompId, CSisRegistryPackage*& aPackage); |
|
69 |
|
70 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const TSisTrustStatus& aTrustStatus); |
|
71 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, TSisTrustStatus& aTrustStatus, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
72 |
|
73 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CHashContainer& aHashContainer, TInt aIndex); |
|
74 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CHashContainer*& aHashContainer, TInt aIndex); |
|
75 |
|
76 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const CHashContainer& aHashContainer, const TDesC& aFileName); |
|
77 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CHashContainer*& aHashContainer, const TDesC& aFileName); |
|
78 |
|
79 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aCompUid, const TDesC& aCompName, Sis::TInstallType aInstallType, CSisRegistryDependency& aRegistryDependency); |
|
80 void ReadFromScrL(Usif::CVersionedComponentId& aVersionedSupplierCompId, CSisRegistryDependency*& aRegistryDependency); |
|
81 // Published partner friends set end |
|
82 |
|
83 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CControllerInfo& aControllerInfo, TInt aIndex); |
|
84 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CControllerInfo*& aControllerInfo, TInt aIndex); |
|
85 |
|
86 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryProperty& aRegistryProperty, TInt aIndex); |
|
87 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryProperty*& aRegistryProperty, TInt aIndex); |
|
88 |
|
89 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryFileDescription& aFileDescription, TBool aWildcardedFile, TInt aIndex, TInt aExecutableIndex); |
|
90 void ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryFileDescription*& aFileDescription, const TDesC& aFileName, TBool aWildcardedFile); |
|
91 |
|
92 void ExternalizeSidArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const RArray<TUid>& aSidsArray); |
|
93 void ExternalizeControllerArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const RPointerArray<CControllerInfo>& aControllerInfoArray); |
|
94 void ExternalizeSupplierPackageArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aCompUid, const TDesC& aCompName, Sis::TInstallType aInstallType, RPointerArray<CSisRegistryDependency>& aDependentPackageArray); |
|
95 void ExternalizeEmbeddedPackageArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CSisRegistryPackage>& aEmbeddedPackageArray); |
|
96 void ExternalizePropertiesArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CSisRegistryProperty>& aRegistryPropertyArray); |
|
97 void ExternalizeFileDescriptionsArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CSisRegistryFileDescription>& aFileDescriptionArray); |
|
98 void ExternalizeChainIndexArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const RArray<TInt>& aChainIndexArray); |
|
99 |
|
100 void InternalizeSidArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RArray<TUid>& aSidsArray, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
101 void InternalizeControllerArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CControllerInfo>& aControllerInfoArray, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
102 void InternalizeSupplierPackageArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aCompUid, const TDesC& aCompName, Sis::TInstallType aInstallType, RPointerArray<CSisRegistryDependency>& aDependentPackageArray); |
|
103 void InternalizeEmbeddedPackageArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CSisRegistryPackage>& aEmbeddedPackageArray, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
104 void InternalizePropertiesArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CSisRegistryProperty>& aRegistryPropertyArray, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
105 void InternalizeFileDescriptionsArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RPointerArray<CSisRegistryFileDescription>& aFileDescriptionArray); |
|
106 void InternalizeChainIndexArrayL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, RArray<TInt>& aChainIndexArray, RPointerArray<Usif::CPropertyEntry>* aPropertyArray=NULL); |
|
107 |
|
108 TBool IsUidPresentL(const Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aPackageUid); |
|
109 |
|
110 TBool IsUidAndNamePresentL(const Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aPackageUid, const TDesC& aPackageName); |
|
111 |
|
112 TBool GetComponentIdL(const Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aPackageUid, const TInt aPackageIndex, Usif::TComponentId& aComponentId); |
|
113 Usif::TComponentId GetComponentIdL(const Usif::RSoftwareComponentRegistry& aScrSession, const TUid& aPackageUid, const TInt aPackageIndex); |
|
114 |
|
115 TBool GetComponentIdL(const Usif::RSoftwareComponentRegistry& aScrSession, const TDesC& aPackageName, const TDesC& aVendorName, Usif::TComponentId& aComponentId); |
|
116 /** |
|
117 * Returns the component matching the given package name and vendor name |
|
118 * NOTE: There can be multiple such components and this API returns the first one found! |
|
119 */ |
|
120 Usif::TComponentId GetComponentIdL(const Usif::RSoftwareComponentRegistry& aScrSession, const TDesC& aPackageName, const TDesC& aVendorName); |
|
121 |
|
122 void GetComponentIdListL(const Usif::RSoftwareComponentRegistry& aScrSession, RArray<Usif::TComponentId>& aComponentIdList); |
|
123 |
|
124 // Returns ETrue if the filname either ends with a '\' or contains any wildcards ('?' or '*') |
|
125 TBool IsWildcardFile(const TDesC& aFileName); |
|
126 |
|
127 void ExtractCompUidL(const TDesC& aCompGlobalId, TUid& aUid); |
|
128 |
|
129 TInt FindPropertyL(const RPointerArray<Usif::CPropertyEntry>& aProperties, const TDesC& aPropertyName); |
|
130 TInt GetIntegerPropertyValueFromArrayL(const TDesC& aPropertyName, TInt aDefaultValue, const RPointerArray<Usif::CPropertyEntry>& aProperties); |
|
131 // Retrieve SWI logs |
|
132 HBufC8* GetLogInfoLC(const Usif::RSoftwareComponentRegistry& aScrSession, TInt aMaxLogEntries); |
|
133 |
|
134 void WriteToScrL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::TComponentId& aCompId, CSisRegistryObject& aObject, Usif::TScrComponentOperationType aOpType); |
|
135 |
|
136 } // End of name space ScrHelperUtil |
|
137 |
|
138 // Other name space wide common utility methods |
|
139 TInt GetIntPropertyValueL(const Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const TDesC& aPropertyName, TBool aAlwaysExpectedInDb, TInt aDefaultValue = 0); |
|
140 TInt64 GetInt64PropertyValueL(const Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const TDesC& aPropertyName, TBool aAlwaysExpectedInDb, TInt64 aDefaultValue = 0); |
|
141 HBufC* GetStrPropertyValueL(const Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const TDesC& aPropertyName, const TLanguage aLocale = Usif::KUnspecifiedLocale, TBool aAlwaysExpectedInDb = ETrue); |
|
142 HBufC8* GetBinaryPropertyValueL(const Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, const TDesC& aPropertyName); |
|
143 |
|
144 // Creates the bit mask formated drives from the TDriveList (string) formated drive. |
|
145 void MakeDrivesFromStringL(TDriveList& aDriveList, TUint& aDrive); |
|
146 |
|
147 // Version conversion methods. |
|
148 void VersionToString(const TVersion& aVersion, TDes& aVersionString); |
|
149 void StringToVersionL(const TDesC& aVersionString, TVersion& aVersion); |
|
150 |
|
151 // Format the component global Id based on the install type. |
|
152 HBufC* FormatGlobalIdLC(const TUid& aCompUid, const TDesC& aCompName, Sis::TInstallType aInstallType); |
|
153 } // End of name space Swi |
|
154 #endif // End of __SCRHELPERUTIL_H__ |