secureswitools/swisistools/source/interpretsislib/dbhelper.h
changeset 0 ba25891c3a9e
child 25 98b66e4fb0be
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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 * DbHelper - Interfaces for accessing details from the database.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @released
       
    23  @internalTechnology
       
    24 */
       
    25 
       
    26 #ifndef DBHELPER_H
       
    27 #define DBHELPER_H
       
    28 
       
    29 #pragma warning(disable: 4786)
       
    30 
       
    31 #include <string>
       
    32 #include <vector>
       
    33 #include "symbiantypes.h"
       
    34 
       
    35 class CDbProcessor;
       
    36 class SisRegistryObject;
       
    37 class SisRegistryToken;
       
    38 class SisRegistryPackage;
       
    39 class FileDescription;
       
    40 class CStatement;
       
    41 class SisRegistryDependency;
       
    42 class Version;
       
    43 class SisRegistryProperty;
       
    44 class TrustStatus;
       
    45 class ControllerInfo;
       
    46 
       
    47 class DbHelper
       
    48 	{
       
    49 	public:
       
    50 		DbHelper( const std::wstring& aDrivePath, bool aIsSystemDrive);
       
    51 		TBool IsInstalled(TInt32 aUid) const;
       
    52 		bool InternalizeIfExists(SisRegistryObject& aSisRegistryObject, const TUint32 aUid ) const;
       
    53 		
       
    54 		bool GetIsRemovable( TInt32 aComponentId ) const;
       
    55 		bool GetInRom( TInt32 aComponentId ) const;
       
    56 		std::wstring GetPackageName( TInt32 aComponentId ) const;
       
    57 		TUint32 GetUid( TInt32 aComponentId ) const;
       
    58 		TUint32 GetInstallType( TInt32 aComponentId ) const;
       
    59 		void RemoveEntry( TInt32 aComponentId ) const;
       
    60 		int GetSelectedDrive( TInt32 aComponentId );
       
    61 		std::vector<FileDescription*> GetFileDescriptions( TInt32 aComponentId ) const;
       
    62 		bool SidExists(const TUint32 aSid) const;
       
    63 		TUint32 GetUid(const TUint32 aSid) const;
       
    64 		std::wstring SidToFileName(TUint32 aSid) const;
       
    65 		TUint32 GetUid( const std::wstring& aSidFile ) const;
       
    66 
       
    67 		TInt32 GetComponentId(TInt32 aUid, const std::wstring aPackageName, const std::wstring aVendorName ) const;
       
    68 		TInt32 GetComponentId(TInt32 aUid, TInt32 aInstallType ) const;
       
    69 		TInt32 GetComponentId( TInt32 aUid ) const;
       
    70 		std::vector<TInt32> GetComponentIdList( TInt32 aUid ) const;
       
    71 		TInt GetIndex( TInt32 aComponentId) const;
       
    72 		TUint32 GetUidFromFileName( const std::wstring& aFileName ) const;
       
    73 		TInt GetIndex( TUint32 aPackageUid) const;
       
    74 
       
    75 	private:
       
    76 		TInt32 GetComponentPropertyIntValue( TInt32 aComponentId, std::wstring aComponentPropertyName, TInt32 aDefaultValue = DbHelper::Absent ) const;
       
    77 		TInt32 GetComponentPropertyIntFormattedValue(TInt32 aComponentId, std::wstring aComponentPropertyName, TInt32 aIntFormatter) const;
       
    78 		std::wstring GetComponentPropertyStrValue(TInt32 aComponentId, std::wstring aComponentPropertyName, TInt32 aIntFormatter) const;
       
    79 		std::wstring GetComponentPropertyStrValue(TInt32 aComponentId, std::wstring aComponentPropertyName) const;
       
    80 
       
    81 		void GetComponentDetails( TInt32 aComponentId, SisRegistryObject& aSisRegistryObject ) const;
       
    82 		void GetComponentLocalizables( TInt32 aComponentId, SisRegistryObject& aSisRegistryObject ) const;
       
    83 		void GetFileDescriptions( TInt32 aComponentId, SisRegistryObject& aSisRegistryObject ) const;
       
    84 		void GetFileDescriptionFromComponentProperties( int aComponentId, std::vector<FileDescription*>& aFileDescriptions) const;
       
    85 		void GetFileDescriptionFromFileProperties( int aComponentId, std::vector<FileDescription*>& aFileDescriptions) const;
       
    86 		void GetComponentProperties( TInt32 aComponentId, SisRegistryObject& aSisRegistryObject ) const;
       
    87 		std::vector<SisRegistryDependency*> GetDependencies( TInt32 aComponentId ) const;
       
    88 		std::vector<SisRegistryPackage*> DbHelper::GetEmbeddedPackages( TInt32 aComponentId ) const;
       
    89 		std::vector<SisRegistryProperty*> GetProperties( TInt32 aComponentId ) const;
       
    90 		TrustStatus GetTrustStatus( TInt32 aComponentId ) const;
       
    91 		std::vector<TInt> GetInstallChainIndices( TInt32 aComponentId ) const;
       
    92 		std::vector<TUint32> GetSids( TInt32 aComponentId ) const;
       
    93 		std::vector<ControllerInfo*> GetControllerInfo( TInt32 aComponentId ) const;
       
    94 
       
    95 	private:
       
    96 		// other helper methods
       
    97 		std::wstring FormatDbString(std::wstring aString, int aValue) const;
       
    98 		void AddFileDescription(CStatement* aStatement, FileDescription& aFileDescription, TInt aCount ) const;
       
    99 		Version FormatStringToVersion(std::wstring aVersionStr) const;
       
   100 
       
   101 	private:
       
   102 		CDbProcessor* iScrDbHandler;
       
   103 		
       
   104 	public:
       
   105 		const static int Absent;
       
   106 	};
       
   107 
       
   108 #endif // DBHELPER_H