EXPORT_C TInt CMsvTestUtils::AppendScheduleTimeL(TMsvId aEntryId, TDes& rOutput) { TTime entryTime, schTime; TTaskInfo info; TInt err = ScheduleTime(aEntryId, entryTime, schTime, info); if (!err) { TBuf<128> dateString; entryTime.FormatL(dateString, _L("\tEntry: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B")); rOutput.Append(dateString); schTime.FormatL(dateString, _L("\n\tSched: %D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B")); rOutput.Append(dateString); rOutput.AppendFormat(_L(" (taskId %d)\n"), info.iTaskId); } else { rOutput.AppendFormat(_L("\tError %d: Cannot read schedule time for msg %d\n"), err, aEntryId); } return err; }
EXPORT_C void TSTStringFormatter::AppendFileLength(TInt64 aLength, TDes &aLengthStr) { if (aLength<0) return; TInt range; for (range=0;range<3;++range) { if (aLength<1000*1000) break; // keep some digits from fraction aLength/=1000; } #ifdef EKA2 TReal len=aLength; #else TReal len=aLength.GetTInt(); #endif if (len>1000) { len/=1000; ++range; } if (range==0) aLengthStr.AppendFormat(_L("%.0f"),len); else aLengthStr.AppendFormat(_L("%.1f"),len); switch (range) { case 0: aLengthStr.Append(_L(" B")); break; case 1: aLengthStr.Append(_L(" kB")); break; case 2: aLengthStr.Append(_L(" MB")); break; case 3: aLengthStr.Append(_L(" GB")); break; case 4: aLengthStr.Append(_L(" TB")); break; default: __ASSERT_DEBUG(false,User::Panic(_L("#TStringFormatter"),0)); } }
// Gets the state and priority of process aproc. Writes state into buffer //pointed to by aprocstate and returns priority as an integer int getProcessState(RProcess& aproc,TDes& aprocstate) { TExitType exittype; TProcessPriority prio; exittype = aproc.ExitType(); prio = aproc.Priority(); switch(exittype) { case EExitPending: aprocstate.Append(_L("R")); break; case EExitPanic: aprocstate.Append(_L("P")); break; case EExitKill: case EExitTerminate: aprocstate.Append(_L("X")); return -1; } switch(prio) { case EPriorityLow: case EPriorityBackground: case EPriorityForeground: aprocstate.Append(_L("N")); break; default: // All other cases aprocstate.Append(_L("<")); break; } return prio; }
// ----------------------------------------------------------------------------- // Appends drive letter and double colon to a descriptor. // Path should be zero length when calling this method. // ----------------------------------------------------------------------------- // void AppendDriveLetterToDes( const TInt aDrive, TDes& aPath ) { TChar driveLetter; RFs::DriveToChar( aDrive, driveLetter ); aPath.Append( driveLetter ); aPath.Append( KAknsSrvDoubleColon ); }
// ----------------------------------------------------------------------------- // Gets skin directory as descriptor based on drive type and array loc. // ----------------------------------------------------------------------------- // void CAknsSrvDriveMaster::SkinDirectoryOnDrive( TAknsSrvSkinDriveList aDriveType, TInt aLocation, TDes& aPath ) const { AKNS_TRACE_INFO("CAknsSrvDriveMaster::SkinDirectoryOnDrive"); TInt driveNumber = KErrNotFound; aPath.Zero(); if ( aDriveType == EAknsSrvStaticDrive ) { if ( iStaticDriveArray.Count() == 0 ) { return; } if ( aLocation >= 0 && aLocation <= iStaticDriveArray.Count() ) { driveNumber = iStaticDriveArray[ aLocation ]; AppendDriveLetterToDes( driveNumber, aPath ); aPath.Append( KAknSkinSrvPrivateSkinPath ); } } else if ( aDriveType == EAknsSrvRemovableDrive ) { if ( iRemovableDriveArray.Count() == 0 ) { return; } if ( aLocation >= 0 && aLocation <= iRemovableDriveArray.Count() ) { driveNumber = iRemovableDriveArray[ aLocation ]; AppendDriveLetterToDes( driveNumber, aPath ); aPath.Append( KAknSkinSrvPrivateSkinPath ); } } }
/** * Return SVG filename. */ void CFuiTheme::SvgFile( TDes& aFileName ) { aFileName.Append( KResourcePath ); aFileName.Append( iName ); aFileName.Append( KMifExt ); aFileName[0] = RProcess().FileName()[0]; }
void CSCOMOAdapterDb::PrepareLuidQuery(TInt aLuid, TDes& aSqlQuery) { aSqlQuery.Copy(_L("SELECT * FROM ")); aSqlQuery.Append(KTableAMMgmtObject); aSqlQuery.Append(_L(" WHERE ")); aSqlQuery.Append(NCol2); aSqlQuery.Append(_L(" = ")); aSqlQuery.AppendNum(aLuid); }
// --------------------------------------------------------------------------- // CGbaServer::MakePrivateFilenameL() // --------------------------------------------------------------------------- // void CGbaServer::MakePrivateFilenameL(RFs& aFs, const TDesC& aLeafName, TDes& aNameOut) const { aNameOut.Copy(KGBAStoreStandardDrive); // Get private path TBuf<KPrivateFilepathLength> privatePath; aFs.PrivatePath(privatePath); aNameOut.Append(privatePath); aNameOut.Append(aLeafName); }
void CHlpFileEntry::GetFullNameAndPath(TDes& aName) const { TChar driveLetter = '?'; RFs::DriveToChar(Drive(), driveLetter); aName.Zero(); aName.Append(driveLetter); aName.Append(':'); aName.Append(KHlpFileSearchPath); aName.Append(FileName()); }
// --------------------------------------------------------- // CAreaSearchResult::Print() // // (other items were commented in a header). // --------------------------------------------------------- // void CAreaSearchResult::Print(TDes& aPrint) { TChar del(','); TBuf<KMaxFieldLength> info; _LIT(KPosInfo, "SouthLat=%g, NortLat=%g, WestLong=%g, EastLong=%g"); info.Format(KPosInfo, iSouthLat, iNorthLat, iWestLong, iEastLong); aPrint.Append(info); aPrint.Append(del); _LIT(KRedefined, "Redefined=%d"); info.Format(KRedefined, iRedefined); aPrint.Append(info); aPrint.Append(del); _LIT(KErrorCode, "ErrorCode = %d"); info.Format(KErrorCode, iErrorCode); aPrint.Append(info); aPrint.Append(del); aPrint.Append(_L("Search result = ")); for (TInt i=0; i<iSearchResult.Count(); i++) { _LIT(KSearchResult, "%d"); info.Format(KSearchResult, iSearchResult[i]); aPrint.Append(info); aPrint.Append(del); } }
void CSearchLocalResultView::GetCopyToPath(TInt aIndex,TDes& aPath) { aPath.Append(iMainEngine.GetAppDrive()); aPath.Append(_L("\\Data\\CoCo\\")); switch(aIndex) { case 0: aPath.Append(KIMAGES); break; case 1: aPath.Append(KMUSIC); break; case 2: aPath.Append(KAPPS); break; case 3: aPath.Append(KVIDEO); break; case 4: aPath.Append(KAPPS); break; case 5: aPath.Append(KBOOKS); break; case 6: aPath.Append(KTOPS); break; } }
void FormatAtt(TDes& aBuffer, const TUint aValue) { _LIT(KAttsMsg,"Attributes set are:"); _LIT(KNormal," Normal"); _LIT(KReadOnly," Read-only"); _LIT(KHidden," Hidden"); _LIT(KSystem," System"); _LIT(KVolume," Volume"); _LIT(KDir," Directory"); _LIT(KArchive," Archive"); _LIT(KNewLine,"\n"); aBuffer.Append(KAttsMsg); if (aValue & KEntryAttNormal) { aBuffer.Append(KNormal); return; } if (aValue & KEntryAttReadOnly) aBuffer.Append(KReadOnly); if (aValue & KEntryAttHidden) aBuffer.Append(KHidden); if (aValue & KEntryAttSystem) aBuffer.Append(KSystem); if (aValue & KEntryAttVolume) aBuffer.Append(KVolume); if (aValue & KEntryAttDir) aBuffer.Append(KDir); if (aValue & KEntryAttArchive) aBuffer.Append(KArchive); aBuffer.Append(KNewLine); }
/** Construct a descriptor containing the composite file name from the DLL to load @param aSwp The swp to create the file name for @param aLibraryFilename reference to object in which file name is returned @leave KErrNotFound If the swp is not registered */ void CSsmSwpPolicyResolver::GetFileNameForSwpL(const TSsmSwp& aSwp, TDes& aLibraryFilename) const { aLibraryFilename.Zero(); aLibraryFilename.Append(KRomDriveLetter); aLibraryFilename.Append(iSwpPolicyMap->FilenameL(aSwp.Key())); const TInt postfixLength = KDllFilenamePostfix().Length(); if(KDllFilenamePostfix().CompareF(aLibraryFilename.Right(postfixLength))) { aLibraryFilename.Append(KDllFilenamePostfix); } }
void CJournalFile::NextBackupFileNameL(TDes& aBackupFileName) { TParsePtrC fileNamePtr(iJournalFileName); aBackupFileName = fileNamePtr.DriveAndPath(); aBackupFileName.Append(fileNamePtr.Name()); aBackupFileName.Append(KPathDelimiter); aBackupFileName.AppendNumUC(iBackupFilesCount, EHex); aBackupFileName.Append(KExtDelimiter); aBackupFileName.Append(KBackupExt); iBackupFilesCount++; }
// ----------------------------------------------------------------------------- // Shared by GetBtEskFilename and GetIrdaEskFilename // ----------------------------------------------------------------------------- static void GetEskFilename( TDes& aBuff, const TDesC& aFileName ) { TInt maxLen = aBuff.MaxLength(); aBuff.SetLength(maxLen); ::GetModuleFileName(NULL, &(aBuff[0]), maxLen); aBuff[aBuff.MaxLength() - 1] = 0; aBuff.SetLength(User::StringLength(aBuff.Ptr())); aBuff.SetLength(aBuff.LocateReverse('\\') + 1); aBuff.Append(_L( "z\\private\\101f7989\\ESock\\")); aBuff.Append(aFileName); aBuff.ZeroTerminate(); }
// -------------------------------------------------------------------------- // CUPnPPlayListFiller::ConvertToURI // Convert UPnP item to playlist item URI string // -------------------------------------------------------------------------- // void CUPnPPlayListFiller::ConvertToURI( const TDesC& aDeviceUid, const CUpnpObject& aItem, TDes& aBuffer ) { // Start with upnp prefix aBuffer.Copy( KUPnPPrefix ); aBuffer.Append( aDeviceUid ); aBuffer.Append( KSeparator ); // add object id (converting 8->16 bit) TBuf<KMaxElementSize> id16; id16.Copy( aItem.Id() ); aBuffer.Append( id16 ); }
TInt CSecMgrStore::GetPolicyPath(TDes& aFile) { TInt ret(GetPrivatePath (aFile)); if ( KErrNone==ret) { aFile.Append (KPolicyDir); aFile.Append (KDirSeparator); TRAP (ret, BaflUtils::EnsurePathExistsL (iFsSession, aFile)); } return ret; }
void TlsCacheUtil::BuildCacheFileNameL(TDes& aFileName, TUid aSid, RFs& aFs) { TDriveUnit drive(SystemDrive()); TDriveName driveName(drive.Name()); aFileName.Append(driveName); TPath path; User::LeaveIfError(aFs.PrivatePath(path)); aFileName.Append(path); _LIT(KCacheExtension, ".cce"); aFileName.AppendNum(aSid.iUid, EHex); aFileName.Append(KCacheExtension); }
/** * Append escaped aLiteral to the end of aBuffer. This means appenging aLiteral, * with all '-s changed to ''-s. * @param aBuffer Buffer to append to. * @param aLiteral Literal to append escaped. */ LOCAL_C void AppendEscaped( TDes& aBuffer, const TDesC& aLiteral ) { TInt i; TUint quote('\''); // TChar gives warnings in THUMB & ARMI for ( i = 0; i < aLiteral.Length(); i++ ) { aBuffer.Append( aLiteral[i] ); if ( aLiteral[i] == quote ) { // Duplicate quote. aBuffer.Append( quote ); } } }
// appends .<PLATFORM>.<VARIANT>.log to aFileName; void CTestUtils::AppendVariantName(TDes& aFileName) { #if (defined(__THUMB__) || defined(__MARM_THUMB__)) aFileName.Append(_L(".THUMB.")); #endif #if (defined(__ARMI__) || defined(__MARM_ARMI__)) aFileName.Append(_L(".ARMI.")); #endif #if (defined(__ARM4__) || defined(__MISA__) || defined(__MARM_ARM4__)) aFileName.Append(_L(".ARM4.")); #endif #if defined(__WINSCW__) aFileName.Append(_L(".WINSCW.")); #else #if defined(__WINS__) aFileName.Append(_L(".WINS.")); #endif #endif #if defined(_DEBUG) aFileName.Append(_L("DEB.")); #else aFileName.Append(_L("REL.")); #endif aFileName.Append(_L("LOG")); }
// ----------------------------------------------------------------------------- // UnicodeTextUtil::ConvertVoicedKatakanaChar // Converts one Voiced Katakana Char in the direction specified by aDirection, // and appends to the descriptor, aTarget. // If aSemiVoiced is ETrue, then the code point is converted to the Semi-voiced // variant. // Assumes aVoicedKatakana is within range. // ----------------------------------------------------------------------------- // void UnicodeTextUtil::ConvertVoicedKatakanaCharAndAppendToTarget( TConvDirection aDirection, TText aVoicedKatakana, TDes& aTarget, TBool aSemiVoiced ) { __ASSERT_DEBUG( IsFullWidthVoicedConvertableHalfWidthBaseKatakana( aVoicedKatakana ) || IsFullWidthVoicedKatakana( aVoicedKatakana, aSemiVoiced ), User::Panic( KJPLangUtilPanic, EErrNotVoicedKatakana ) ); const TInt voicableRange( aSemiVoiced ? KFullWidthSemiVoicableKatakanaRange : KFullWidthVoicableKatakanaRange ); const TText* const (*voicedTable) = aSemiVoiced ? KHalfWidthBaseToFullWidthSemiVoicedKatakanaTable : KHalfWidthBaseToFullWidthVoicedKatakanaTable; if( aDirection == EHalfToFullWidth ) { // In the case of Half Width, only the base character is needed for // the conversion for( TInt i( 0 ); i < voicableRange; ++i ) { if( aVoicedKatakana == voicedTable[i][KHalfWidthIndex] ) { const TChar uniChar( voicedTable[i][KFullWidthIndex] ); aTarget.Append( uniChar ); break; } } } else { for( TInt i( 0 ); i < voicableRange; ++i ) { if( aVoicedKatakana == voicedTable[i][KFullWidthIndex] ) { const TChar uniChar( voicedTable[i][KHalfWidthIndex] ); aTarget.Append( uniChar ); break; } } const TChar voicedSoundMark( aSemiVoiced ? KHalfWidthKatakanaSemiVoicedSoundMark : KHalfWidthKatakanaVoicedSoundMark ); aTarget.Append( voicedSoundMark ); } }
LOCAL_C TInt readConsoleLineBuf(const TDesC& aPrompt, TDes& aBuf) { test.Printf(_L("\n ")); TBool quit = EFalse; _LIT(KDeleteChar, "\b \b"); test.Printf(aPrompt); while (!quit) { TKeyCode k = test.Getch(); TChar key = k; switch (key) { case EKeyBackspace: if (aBuf.Length() > 0) { test.Printf(KDeleteChar); aBuf = aBuf.Left(aBuf.Length() - 1); } break; case EKeyEnter: if (aBuf.Length()) quit = ETrue; else test.Printf(_L("\nLogin, password and server address cannot be zero length ")); break; default: test.Printf(_L("%c"), key); aBuf.Append(key); break; } } return(KErrNone); }
/** * Connection is opened to location server,and closed * * If anything fails during the execution of this test, then function * leaves with proper error code. * * Parameters: **/ void LocationRequestThreadMainPartL(TDes& aErrorBuf) { // Open connection to Location server RPositionServer server; TInt err = server.Connect(); if (err != KErrNone) { _LIT(KErrOpen, "Server open failed with code %d\r\n"); aErrorBuf.Format(KErrOpen, err); } else { _LIT(KOkOpen, "Server open ok\r\n"); aErrorBuf.Copy(KOkOpen); } User::LeaveIfError(err); CleanupClosePushL(server); CleanupStack::PopAndDestroy(1); // server, positioner _LIT(KInfTestComplet, "Test completed ok for this thread\r\n"); aErrorBuf.Append(KInfTestComplet); }
void TBBPair::IntoStringL(TDes& aString) const { iIntVal.IntoStringL(aString); CheckStringSpaceL(aString, 1); aString.Append(_L(" ")); iStringVal.IntoStringL(aString); }
/** @publishedPartner Utility function to obtain the file name from a file share object @param aFileShare A pointer to the file share @param aName A reference to the descriptor to contain the file name */ void TFsPluginRequest::NameFromShare(CFileShare& aFileShare, TDes& aName) { CFileCB& theFile = aFileShare.File(); aName = _L("?:"); aName[0] = TText('A' + theFile.Drive().DriveNumber()); aName.Append(theFile.FileName()); }
// ----------------------------------------------------------------------------- // CNSPTestConsoleApp::GetStringFromConsole // ----------------------------------------------------------------------------- // TKeyCode CNSPTestConsoleApp::GetStringFromConsoleL( TDes& aBuffer ) { TKeyCode input = EKeyNull; const TInt startPos = iConsole->WhereX(); iConsole->Write( aBuffer ); do { input = iConsole->Getch(); if ( ( EKeyBackspace == input || EKeyDelete == input ) && startPos < iConsole->WhereX() ) // Backspace & Delete { iConsole->SetPos( iConsole->WhereX() - 1 ); iConsole->ClearToEndOfLine(); aBuffer.SetLength( 0 < aBuffer.Length() ? aBuffer.Length() - 1 : aBuffer.Length() ); } else{ TChar chr( input ); if ( chr.IsPrint() ) { aBuffer.Append( chr ); iConsole->Printf( _L("%c"), input ); } } } while ( EKeyEnter != input && EKeyEscape != input ); return input; }
TInt CSecMgrStore::GetPrivatePath(TDes& aPrivatePath) { TInt ret(KErrNone); aPrivatePath.Append (KCDrive); HBufC *privateDir = HBufC::NewLC(KMaxName); TPtr ptr(privateDir->Des()); ret = iFsSession.PrivatePath (ptr); if ( KErrNone==ret) { aPrivatePath.Append (ptr); } CleanupStack::PopAndDestroy (privateDir); return ret; }
/* if no length is specified, the whole string is converted */ int ConvertStringToUnicode(const unsigned char* aText, TDes& aDesc, int aLength) { if( aText != NULL ) { /* initialize variables */ aDesc.Zero(); int textlen; /* check the length of the string */ if( aLength == -1 ) { textlen = strlen((char*)aText); } else { textlen = aLength; } /* start copying the string if it's not zero-length */ if( textlen > 0 ) { /* compensate for longer text than descriptor */ if( textlen >= aDesc.MaxLength() ){ textlen = aDesc.MaxLength()-1; } /* copy the data */ for( TInt j=0; j < textlen; j++ ) { aDesc.Append( aText[j] ); } aDesc.PtrZ(); } }else{ return(0); } return(aDesc.Length()); }
// --------------------------------------------------------------------------- // Parses skype id. // SkypeID format: // byte 0: Protocol discriminator: Always 0x00 // byte 1: User-User Information Discriminator. // For MT call this has to be 0x44 // Byte 2: First skype id character a.k.a payload. MSB bit is zero. // Byte 26-33 May have MSB bit set, which are bits of the last character. // The 26 byte's MSB is the last characters MSB bit. // --------------------------------------------------------------------------- // TInt TCSPSkypeIdParser::Parse( const TDesC& aUUIMessage, TDes& aSkypeId ) { const TInt messageLength( aUUIMessage.Length() ); TInt error = KErrNone; const TBool messageSizeOk = (messageLength >= KMinSkypeIdUUILength && messageLength <= KMaxSkypeIdUUILength); if( messageSizeOk && ( aUUIMessage[1] ) == KUUIMTDicriminator ) // address type { TUint lastChar = 0; // skypeId payload starts from the second byte. TInt i = 2; for( ; i < messageLength; i++ ) { TUint byte = aUUIMessage[i]; if( i >= KStartOf31To32EncodingByte ) { // 31 to 32 encoding: last character is build from // 7 last bytes. lastChar = lastChar << 1; lastChar |= (byte>>7)&0x01; } // MSB bit is not part of the character. aSkypeId.Append( byte & 0x7F ); }
TBool CLog::ReadLogLineL(TDes& aLine) { TBuf8<2> character=_L8(" "); TBuf8<4> lineEndTestBuf=_L8(" "); aLine.SetLength(0); while (lineEndTestBuf!=KUnicodeLineEnd) { User::LeaveIfError(iLogFile.Read(character,2)); if (character.Length()>0) { lineEndTestBuf[0]=lineEndTestBuf[2]; lineEndTestBuf[1]=lineEndTestBuf[3]; lineEndTestBuf[2]=character[0]; lineEndTestBuf[3]=character[1]; const TPtrC16 widePtr((TUint16*)character.Ptr(),1); aLine.Append(widePtr); } else { return EFalse; } } aLine=aLine.Left(aLine.Length()-2); // Strip off \n\r. return ETrue; }