sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // CPDTextPersister class sl@0: // sl@0: // sl@0: sl@0: #include "SC_Strings.h" sl@0: #include "SC_TextOut.h" sl@0: sl@0: namespace DBSC sl@0: { sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: inline CPDTextPersister::CPDTextPersister() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: CPDTextPersister* CPDTextPersister::NewLC(RFs& aFs, const TDesC& aTextFileName) sl@0: { sl@0: CPDTextPersister* self = new (ELeave) CPDTextPersister; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aFs, aTextFileName); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: void CPDTextPersister::ConstructL(RFs& aFs, const TDesC& aTextFileName) sl@0: { sl@0: __LEAVE_IF_ERROR(iOutFile.Create(aFs, aTextFileName, EFileRead | EFileWrite)); sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: CPDTextPersister::~CPDTextPersister() sl@0: { sl@0: iOutFile.Close(); sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: void CPDTextPersister::RunL(const TPolicyDomainReader& aPolicyDomainReader) sl@0: { sl@0: WriteDbPolicyL(aPolicyDomainReader); sl@0: WriteTblPoliciesL(aPolicyDomainReader); sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: void CPDTextPersister::WriteDbPolicyL(const TPolicyDomainReader& aPolicyDomainReader) sl@0: { sl@0: const CDbPolicy& dbPolicy = aPolicyDomainReader.DbPolicy(); sl@0: sl@0: iStmt.Copy(KDbStr); sl@0: iStmt.Append(KCrLf); sl@0: __LEAVE_IF_ERROR(iOutFile.Write(iStmt)); sl@0: sl@0: WritePolicyCollection(dbPolicy.PolicyCollection()); sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: void CPDTextPersister::WriteTblPoliciesL(const TPolicyDomainReader& aPolicyDomainReader) sl@0: { sl@0: aPolicyDomainReader.ResetTblPos(); sl@0: const CTblPolicy* tblPolicy; sl@0: while((tblPolicy = aPolicyDomainReader.NextTblPolicy()) != NULL) sl@0: { sl@0: iStmt.Copy(KTblStr); sl@0: iStmt.Append(KCrLf); sl@0: __LEAVE_IF_ERROR(iOutFile.Write(iStmt)); sl@0: sl@0: iStmt.Copy(KNameStr); sl@0: iStmt.Append(KEqStr); sl@0: iStmt.Append(tblPolicy->TableName()); sl@0: iStmt.Append(KCrLf); sl@0: __LEAVE_IF_ERROR(iOutFile.Write(iStmt)); sl@0: sl@0: WritePolicyCollection(tblPolicy->PolicyCollection()); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Non-working implementation! sl@0: There is no way to create text security poliicy representation from a TSecurityInfo instance. sl@0: */ sl@0: void CPDTextPersister::WritePolicyCollection(const CPolicyBase::RPolicyCollection& aPolicyCollection) sl@0: { sl@0: TInt cnt = aPolicyCollection.Count(); sl@0: for(TInt i=0;i