Ejemplo n.º 1
0
// -----------------------------------------------------------------------------
// CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion,
// const TDesC& aDate)
// Constructs element with attributes "Version" and "Date"(eg. 
// "<FW Version="2.2"/>").
// -----------------------------------------------------------------------------
//
void CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion, 
                            const TDesC& aDate)
    {
    _LIT(KFormat1, "<%S %S=\"%S\" %S=\"%S\"/>");
    _LIT(KFormat2, "<%S %S=\"%S\"/>");

    aText=KNullDesC;
    
    TBuf<KTagSize> element;
    TBuf<KTagSize> versionTag;
    TBuf<KTagSize> dateTag;
    
    GetTagL(element, aId);
    GetTagL(versionTag, EAttVersion);
    GetTagL(dateTag, EAttDate);

    if (aDate.Length()>0)
        {
        aText.Format(KFormat1, &element, &versionTag, &aVersion, &dateTag, 
        &aDate);
        }       
    else
        {
        aText.Format(KFormat2, &element, &versionTag, &aVersion);
        }
    }
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
// CapParser::MakeElementL(TDes& aText, TInt aId, TInt aType)
// Constructs element without value (eg. "<Memory>" or "</Memory>").
// -----------------------------------------------------------------------------
//
void CapParser::MakeElementL(TDes& aText, TInt aId, TInt aType)
    {
    _LIT(KFormat1, "<%S>");
    _LIT(KFormat2, "</%S>");
    _LIT(KFormat3, "<%S/>");

    aText=KNullDesC;
    TBuf<KTagSize> buf;
    GetTagL(buf, aId);
    
    switch(aType)
        {
        case TXmlParser::EElementBegin:
            aText.Format(KFormat1, &buf);
            break;
        case TXmlParser::EElementEnd:
            aText.Format(KFormat2, &buf);
            break;
        case TXmlParser::EElementEmpty:
            aText.Format(KFormat3, &buf);
            break;
        default:
            CapUtil::Panic(KErrArgument);
            break;
        }
    }
Ejemplo n.º 3
0
void ScrShotsGenUtils::SetFreeSizeText(CScrShotsStrLoader* strLoader, TDes& aFreeSizeText, TInt64 aDriveFreeSize)
{
    TPtr formatStrFreeSizeCell = strLoader->GetStringHBuf(EDriveListFreeSizeCellFormatString)->Des();
    if((aDriveFreeSize / (KOneGB)) > 0)
        aFreeSizeText.Format(formatStrFreeSizeCell, &KGBStr,aDriveFreeSize / (KOneGB));
    else if((aDriveFreeSize / (KOneMB)) > 0)
        aFreeSizeText.Format(formatStrFreeSizeCell, &KMBStr,aDriveFreeSize / (KOneMB));
    else if((aDriveFreeSize / (KOneKB)) > 0)
        aFreeSizeText.Format(formatStrFreeSizeCell,&KKBStr, aDriveFreeSize / (KOneKB));
    else
        aFreeSizeText.Format(formatStrFreeSizeCell, &KBytesStr,aDriveFreeSize );

}
EXPORT_C void CMemSpyEngineHelperCodeSegment::OutputCodeSegmentsL( TUint aPid, TDes& aLine, const TDesC& aPrefix, TChar aSectionUnderlineCharacter, TBool aLowerCaseSectionHeading)
    {
	_LIT(KHeaderLC, "Code Segments");
	_LIT(KHeaderUC, "CODE SEGMENTS");

	_LIT(KFmtOverflow, "Only first %d code segments displayed");
	_LIT(KFmtMod, "%S%08X-%08X %S");

	const TInt KMaxCount = 256;
	TAny* handles[KMaxCount];
	TInt c = KMaxCount;

	TInt r = iEngine.Driver().GetCodeSegs(aPid, handles, c);
	if  ( r == KErrNone )
    	{
        if  ( c > 0 )
            {
            if  ( aLowerCaseSectionHeading )
                {
                iEngine.Sink().OutputSectionHeadingL( KHeaderLC, aSectionUnderlineCharacter );
                }
            else
                {
            	iEngine.Sink().OutputSectionHeadingL( KHeaderUC, aSectionUnderlineCharacter );
                }

        	if (c > KMaxCount)
        		{
        		c = KMaxCount;
        		aLine.Format(KFmtOverflow, c);
        		iEngine.Sink().OutputLineL( aLine );
        		}

        	TBuf<KMaxFileName> path;
        	TMemSpyDriverCodeSegInfo info;
        	for (TInt i=0; i<c; i++)
        		{
        		r = iEngine.Driver().GetCodeSegInfo(handles[i], aPid, info);
                //
        		if  ( r == KErrNone )
        			{
        			path.Copy( info.iCreateInfo.iFileName );
        			aLine.Format(KFmtMod, &aPrefix, info.iMemoryInfo.iCodeBase,info.iMemoryInfo.iCodeBase + info.iMemoryInfo.iCodeSize, &path);
        			iEngine.Sink().OutputLineL( aLine );
        			}
        		}
            }
        }
   }
/**
 * 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);
    }
Ejemplo n.º 6
0
void MemSpyEngineUtils::FormatTimeSimple( TDes& aBuf, const TTime& aTime )
    {
    const TDateTime dt = aTime.DateTime();
    //
    _LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" );
    aBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() );
    }
Ejemplo n.º 7
0
// ---------------------------------------------------------------------------
// CSsmShutdownPolicy::GetCommandListPathL
// ---------------------------------------------------------------------------
//
void CSsmShutdownPolicy::GetCommandListPathL( TDes& aCmdListPath )
    {
    FUNC_LOG;

	aCmdListPath.Format( KCommandListPath );
	iUtil->GetCommandListPath( aCmdListPath );
    }
Ejemplo n.º 8
0
/**
 *	Create a list box item with the given column values.
 */
void CSettingList::CreateListBoxItemL( TDes& aBuffer, 
		const TDesC& aMainText,
		const TDesC& aSecondaryText )
	{
	_LIT ( KStringHeader, "\t%S\t%S" );
	
	aBuffer.Format( KStringHeader(), &aMainText, &aSecondaryText );
	} 
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::ClientAppFolder
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::ClientAppFolder( 
                                                    const CHttpClientApp* aClientApp, 
                                                    TDes& aFolder )
    {
    _LIT( KClientAppFolderFormat, "%S%x\\" );

    aFolder.Format( KClientAppFolderFormat, &KDmDefaultDir, aClientApp->AppUid() );
    }
Ejemplo n.º 10
0
void TAzenqosEngineUtils::MakeTimeStrMilli(TTime &time,TDes& str) //str should be at least 19 in length
{

	const TInt KThousand = 1000;

	TDateTime date = time.DateTime();
	str.Format(KTimeStampMillisecFormat,date.Year()%2000,date.Month()+1,date.Day()+1,date.Hour(),date.Minute(),date.Second(),date.MicroSecond()*KThousand);

}
Ejemplo n.º 11
0
void CScrShotsDriveGrid::SetTotalSizeText(TDes& aTotalSizeText, TInt64 aDriveTotalSize)
{
    TPtr formatStr = iParentControl->GetAppView()->GetAppUi().GetStrLoader()->GetStringHBuf(EDriveTotalSizeFormatString)->Des();

    if((aDriveTotalSize / (KOneGB)) > 0){
        aTotalSizeText.Format(formatStr,&KGBStr,aDriveTotalSize / (KOneGB));
    }
    else if((aDriveTotalSize / (KOneMB)) > 0){
        aTotalSizeText.Format(formatStr,&KMBStr,aDriveTotalSize / (KOneMB));
    }
    else if((aDriveTotalSize / (KOneKB)) > 0){
        aTotalSizeText.Format(formatStr,&KKBStr, aDriveTotalSize / (KOneKB));
    }
    else{
        aTotalSizeText.Format(formatStr,&KBytesStr,aDriveTotalSize );
    }

}
Ejemplo n.º 12
0
void CPodcastAppUi::GetErrorTextL(TDes &aErrorMessage, TInt aErrorCode)
	{
	switch (aErrorCode)
		{
		case KErrNotFound:
			{
			HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_INVALID_ADDRESS);
			aErrorMessage.Copy(*error);
			CleanupStack::PopAndDestroy(error);
			}
			break;
		case KErrDiskFull:
			{
			HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_DISK_FULL);
			aErrorMessage.Copy(*error);
			CleanupStack::PopAndDestroy(error);
			}
			break;
		case 404:
			{
			HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_NOTFOUND);
			aErrorMessage.Copy(*error);
			CleanupStack::PopAndDestroy(error);
			}
			break;
		default:
			{
			if (aErrorCode > 200)
				{
				HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_HTTP);
				aErrorMessage.Format(*error, aErrorCode);
				CleanupStack::PopAndDestroy(error);
				}
			else
				{
				HBufC* error = iCoeEnv->AllocReadResourceLC(R_ERROR_GENERAL);
				aErrorMessage.Format(*error, aErrorCode);
				CleanupStack::PopAndDestroy(error);
				}
			}
			break;
		}
	}
void CMemSpyEngineHelperChunk::DoOutputChunkInfoForObjectL( TUint aId, TDes& aLineBuffer, TType aType )
    {
    TFullName ownerName;
	//
    RArray<TAny*> handles( 128 );
    CleanupClosePushL( handles );
    //
    GetChunkHandlesL( handles, aType, aId );
    CMemSpyEngineChunkList* list = CreateListFromHandlesL( handles );
    //
    CleanupStack::PopAndDestroy( &handles );
    CleanupStack::PushL( list );
    //
    const TInt count = list->Count();
    for (TInt i=0; i<count; i++)
    	{
        const CMemSpyEngineChunkEntry& entry = list->At( i );
        //
        _LIT(KLine1, "Name");
        iEngine.Sink().OutputItemAndValueL( KLine1, entry.Name() );
        //
        _LIT(KLine2, "Owner");
        entry.OwnerName( ownerName );
        iEngine.Sink().OutputItemAndValueL( KLine2, ownerName );
        //
        _LIT(KLine3, "Address");
        _LIT(KLine3Format, "0x%08x - 0x%08x");
        aLineBuffer.Format(KLine3Format, entry.BaseAddress(), entry.UpperAddress() );
        iEngine.Sink().OutputItemAndValueL( KLine3, aLineBuffer );
        //
        _LIT(KLine4, "Size (max)");
        _LIT(KLine4Format, "%d (%d)");
        aLineBuffer.Format(KLine4Format, entry.Size(), entry.MaxSize());
        iEngine.Sink().OutputItemAndValueL( KLine4, aLineBuffer );
        //
        if  ( i < count - 1 )
            {
            iEngine.Sink().OutputBlankLineL();
    		}
        }
    //
    CleanupStack::PopAndDestroy( list );
    }
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::DownloadInfoFolder
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::CodFolder( 
                                                const CHttpClientApp* aClientApp, 
                                                TDes& aFolder ) const
    {
    _LIT( KDownloadFolderFormat, "%S%x\\%S\\" );

    aFolder.Format( KDownloadFolderFormat, 
                        &KDmDefaultDir, 
                        aClientApp->AppUid(),
                        &KCodsDirName );
    }
// -----------------------------------------------------------------------------
// CHttpDownloadManagerServerEngine::ClientAppFolder
// ?implementation_description
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CHttpDownloadManagerServerEngine::ClientAppFolderWithoutDriveLetter( 
                                        const CHttpClientApp* aClientApp, 
                                        TDes& aFolder )
    {
    _LIT( KClientAppFolderFormat, "%s%x\\" );

    // [3] cut off the drive letter + ':\\' part
    aFolder.Format( KClientAppFolderFormat, 
                    &KDmDefaultDir()[3], 
                    aClientApp->AppUid() );
    }
/*
Helper function to create command list path for start-up.
Implements fallback mechanism to launch 'sysstart.exe' if static command list for 'start-up' state is not found.
This temporary implementation is required during migration from existing 'sysstart' to 'ssma start-up'.
*/
void CGsaStatePolicyStartup::GetCommandListPath(TUint aBootMode, TDes& aCmdListPath)
	{
	aCmdListPath.Format(KCommandListPath, aBootMode);
	TBool found = BaflUtils::FolderExists(iFs, aCmdListPath);

	// This Fallback mechanism is used internally during migration from 'sysstart' to 'ssma start-up' and is not required otherwise.
	if (!found)
		{
		aCmdListPath.Copy(KFallbackCmdListPath());
		iLaunchSysStart = ETrue;	// launch 'sysstart.exe'
		}
	}
Ejemplo n.º 17
0
//Get DSC database name
void CDscDatabase::GetDatabaseNameL(TDes& aDatabaseName)
	{
	RFs fs;
	CleanupClosePushL(fs);
	User::LeaveIfError(fs.Connect());
	
	// retrieve system drive
	TDriveNumber driveNumber = fs.GetSystemDrive();
 
	// convert to char
    TChar driveChar;
    User::LeaveIfError(RFs::DriveToChar(driveNumber, driveChar));
 
	aDatabaseName.Format(KDatabaseName, (TUint)driveChar);
	CleanupStack::PopAndDestroy(&fs);
	}
/**
 *	Create a list box item with the given column values.
 */
void CNPRListBox::CreateListBoxItemL( TDes& aBuffer, 
		TInt aIconIndex,
		const TDesC& aMainText )
	{
	aBuffer.Format( KStringHeader(), aIconIndex, &aMainText );
	} 
Ejemplo n.º 19
0
static void AssembleLargeFileName(const TDesC& aFileName, TInt aFileNumber, TDes& aResultPath)
	{
	_LIT(KFormatStr, "%S.%03d");
	aResultPath.Format(KFormatStr, &aFileName, aFileNumber);
	}
Ejemplo n.º 20
0
EXPORT_C void MemSpyEngineUtils::FormatHex( TDes& aBuf, TInt aValue )
    {
    _LIT(KMemSpyNumericHexFormat, "0x%08x");
    aBuf.Format( KMemSpyNumericHexFormat, aValue );
    }
void CSearchableListBoxContainer::CreateListBoxItemL( TDes& aBuffer, 
                                                      const TDesC& aMainText )
{
   _LIT( KStringFormat, "\t%S\t\t" );
   aBuffer.Format( KStringFormat(), &aMainText );
} 
Ejemplo n.º 22
0
void TAzenqosEngineUtils::MakeTimeStrFile(TTime &time,TDes& str) //str should be at least 19 in length
	{
		TDateTime date = time.DateTime();
		str.Format(KTimeStampFileFormat,date.Year()%2000,date.Month()+1,date.Day()+1,date.Hour(),date.Minute(),date.Second());
	}