void CStorageManager::SaveDataOwnerL(CDataOwnerInfo& aDataOwner) /** Saves data for DataOwner @param aDataOwner - DataOwner to be saved */ { CDir* dir = NULL; TFileName filename; filename.Append(iBackupDirName); filename.Append(KDataOwnerDir); iTestStep->Fs().MkDirAll(filename); _LIT(KPid, "pid"); _LIT(KSid, "sid"); _LIT(KJid, "jid"); TSBDerivedType type; type = aDataOwner.Identifier().DerivedTypeL(); if (type == ESIDDerivedType) { CSBSecureId* sid = CSBSecureId::NewL(&(aDataOwner.Identifier())); CleanupStack::PushL(sid); filename.Append(KSid); filename.AppendNumUC(sid->SecureIdL(), EHex); CleanupStack::PopAndDestroy(sid); } else if (type == EPackageDerivedType) { CSBPackageId* pid = CSBPackageId::NewL(&(aDataOwner.Identifier())); CleanupStack::PushL(pid); filename.Append(KPid); filename.AppendNumUC(pid->PackageIdL().iUid, EHex); CleanupStack::PopAndDestroy(pid); } else if (type == EJavaDerivedType) { CSBJavaId* jid = CSBJavaId::NewL(&(aDataOwner.Identifier())); CleanupStack::PushL(jid); filename.Append(KJid); filename.Append(jid->SuiteHashL()); CleanupStack::PopAndDestroy(jid); } filename.Append(KBackupExtn); //HBufC8* data = HBufC8::NewLC(aDataOwner.Size()); HBufC8* data = aDataOwner.ExternaliseLC(); WriteToDiskL(filename, *data); CleanupStack::PopAndDestroy(data); delete dir; dir = NULL; }
void CStorageManager::GetSIDPrivateDirName(TChar aDrive, TSecureId aSID, TFileName& aFileName) const /** Gets the name of the directory where the private data is to stored:\n \<backup directory>\\KPrivateDirName\\<aSID>\\ @internalComponent @released @param aDrive - The drive letter of the drive where data resides. @param aSID - SID the data belonds to. @param aFileName - Directory name of the given SID's private directory, generated in line with the implemented naming scheme. */ { aFileName = iBackupDirName; aFileName.AppendNumUC(aSID, EHex); aFileName.Append(KSlash); aFileName.Append(aDrive); aFileName.Append(KSlash); }
void CBCTestPtiEngine::TestChineseInputL() { TeardownL(); if((iEngine = CreateEngineL(ELangPrcChinese, EPtiEngineStroke))!=NULL) { AssertNotNullL(iEngine, _L("Chinese Pinyin activated")); SimuInput(iEngine, _L("wei")); int page=0; iEngine->SetCandidatePageLength(20); AssertTrueL(ETrue, _L("page length set to 20")); for(TPtrC str=iEngine->CandidatePage(); iEngine->MoreCandidatePages(); iEngine->NextCandidatePage()) { TFileName res; res.Format(_L("page[%d]: "), page++); for(int j=0; j<str.Length(); ++j) { res.Append(_L("<")); res.AppendNumUC(str[j], EHex); res.Append(_L(">")); } res.ZeroTerminate(); AssertTrueL(ETrue, res); if(page>10) { break; } }//end of for //predict iEngine->PreviousCandidatePage(); TPtrC aChar=iEngine->CandidatePage(); iEngine->SetPredictiveChineseChar(aChar); AssertTrueL(ETrue, _L("next chinese char predicted")); //test next candidate list iEngine->CommitCurrentWord(); CDesCArray* cands = new (ELeave) CDesCArrayFlat(16); CleanupStack::PushL(cands); TRAPD(err, iEngine->GetNextWordCandidateListL(*cands)); if(err == KErrNotSupported) { AssertTrueL(ETrue, _L("predict next candidate not supported")); } else{ TFileName msg=_L("candidates: "); for (int i = 0; i < cands->Count(); ++i) { msg.Append(cands->MdcaPoint(i)); msg.Append(_L(", ")); } msg.ZeroTerminate(); AssertTrueL(ETrue, msg); } CleanupStack::PopAndDestroy(); // cands //test conversion TInt convCap=iEngine->AvailableCharConversions(); if((convCap & EPtiSimplifiedToComplex)!=0) { AssertTrueL(ETrue, _L("can convert from simplified chinese to traditional")); } else { AssertIntL(0, convCap, _L("conv capability:")); } char inbuf[]={0x76, 0x84}; char outbuf[]={0,0}; iEngine->CharConversion(EPtiSimplifiedToComplex, inbuf, 2, outbuf); AssertTrueL(ETrue, _L("tried char conversion")); //Chinese Varient RArray<TInt> modes; iEngine->GetModeNameIndexL(EPtiChineseVariantPrc, modes); AssertTrueL(ETrue, _L("Chinese varient index table got")); modes.Close(); //phrase list iEngine->ClearCurrentWord(); SimuInput(iEngine, _L("wei")); cands = new (ELeave) CDesCArrayFlat(16); CleanupStack::PushL(cands); iEngine->GetChinesePhraseCandidatesL(*cands); AssertTrueL(ETrue, _L("Chinese phrase candidate list got")); CleanupStack::PopAndDestroy(); //cands TestSpellL(); TestDictL();// test Pinyin dict. } else { AssertTrueL(ETrue, _L("unable to activate Chinese Pinyin")); if ( iEngine == NULL ) { SetupL(); } iEngine->ActivateLanguageL(ELangEnglish, EPtiEnginePredictive); } }
void CStorageManager::GetSIDFileNameL(CSBSIDTransferType* aTransferType, TFileName& aFileName) /** Concatenates the name of the backup file from the information found in aTransferType. @internalComponent @released @param aTransferType - A CSBSIDTransferType* containing information about the type of file name that needs be returned. @param TFilename of the backup file generated in line with the implemented naming scheme */ { __ASSERT_DEBUG(aTransferType != NULL, User::Panic(KBURTestPanicText, ENullTargetPointer)); TSecureId sid; TChar drive; TDriveNumber driveNumber; TTransferDataType dataType; sid = aTransferType->SecureIdL(); dataType = aTransferType->DataTypeL(); driveNumber = aTransferType->DriveNumberL(); // Get the drive letter iTestStep->Fs().DriveToChar(driveNumber, drive); switch(dataType) { case ERegistrationData: { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KRegFilesDir); aFileName.AppendNumUC(sid, EHex); aFileName.Append(KBackupExtn); break; } // No need to create this directory, as it's done in SetupDirs(): case EPassiveSnapshotData: { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KPassiveDataDir); aFileName.Append(KSnapshotDataDir); aFileName.Append(KSnapshot); aFileName.Append(KBackupExtn); break; } case EPassiveBaseData: { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KPassiveDataDir); aFileName.Append(KBaseDataDir); aFileName.Append(KData); aFileName.Append(KBackupExtn); break; } case EPassiveIncrementalData : { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KPassiveDataDir); aFileName.Append(KIncrementalDataDir); break; } case EActiveSnapshotData: { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KActiveDataDir); aFileName.Append(KSnapshotDataDir); aFileName.Append(KSnapshot); aFileName.Append(KBackupExtn); break; } case EActiveBaseData: { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KActiveDataDir); aFileName.Append(KBaseDataDir); aFileName.Append(KData); aFileName.Append(KBackupExtn); break; } case EActiveIncrementalData: { GetSIDPrivateDirName(drive, sid, aFileName); aFileName.Append(KActiveDataDir); aFileName.Append(KIncrementalDataDir); break; } default: { User::Leave(KErrArgument); break; } } }