当前位置: 首页>>代码示例>>C++>>正文


C++ HBufC8::Des方法代码示例

本文整理汇总了C++中HBufC8::Des方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC8::Des方法的具体用法?C++ HBufC8::Des怎么用?C++ HBufC8::Des使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HBufC8的用法示例。


在下文中一共展示了HBufC8::Des方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WriteFormat

EXPORT_C void RTestExecuteLogServ::WriteFormat(TRefByValue<const TDesC8> aFmt, VA_LIST aList)
/**
 * @param aFmt - UNICODE format string
 * @param aList - Variable argument list
 */
	{
	HBufC8* buffer = HBufC8::New(KMaxTestExecuteLogLineLength*2);
	if (buffer)
		{
		TPtr8 ptr(buffer->Des());
		AddTime(ptr);
		TTEFDes8Overflow des8OverflowObject;
		ptr.AppendFormatList(aFmt, aList, &des8OverflowObject);

		TRAP_IGNORE(WriteL(ptr));
		delete buffer;
		}
	else
		{
		TRAP_IGNORE(WriteL((TDes8&)KLoggerNotEnoughMemory8()));
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:22,代码来源:client.cpp

示例2: GetContentToBufferL

EXPORT_C void CBasePlugin::GetContentToBufferL(
    const TFSMailMsgId& aMailBoxId,
    const TFSMailMsgId& /*aParentFolderId*/,
    const TFSMailMsgId& aMessageId,
    const TFSMailMsgId& aMessagePartId,
    TDes& aBuffer,
    const TUint aStartOffset )
    
    {
    __LOG_ENTER( "GetContentToBufferL" )
    
    CMsgStoreMessage* msg = GetCachedMsgL( aMailBoxId.Id(), aMessageId.Id() );
    
    //could the cache be extended to cache the child parts in this case ?
    CMsgStoreMessagePart* part = msg->ChildPartL( aMessagePartId.Id(), ETrue );
    CleanupStack::PushL( part );

    TUint outSize = aBuffer.MaxSize();

    /**@ look for ways to avoid the copying.*/
    __LOG_WRITE8_FORMAT1_INFO( "Output buffer size: %d bytes.", outSize );

    HBufC8* buf = HBufC8::NewLC( outSize );
    TPtr8 ptr = buf->Des();
    part->FetchContentToBufferL( ptr, aStartOffset );
    __LOG_WRITE8_FORMAT1_INFO(
        "Msgstore content buffer size: %d bytes.", buf->Size() );
    
	TUint msgStoreSize = ptr.Size();
	TUint theSize = outSize > msgStoreSize ? msgStoreSize : outSize;
	
	TPtrC16 convert( reinterpret_cast<const TUint16*>( buf->Ptr() ), theSize/2 );
	aBuffer = convert;

    CleanupStack::PopAndDestroy( buf );
    CleanupStack::PopAndDestroy( part );
    
    __LOG_EXIT
    } //GetContentToBufferL.
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:39,代码来源:basepluginparts.cpp

示例3:

TInt CFloggerTest015_01::DoTestCheckWriteL()
	{

	RFile theFile;
	HBufC8 * hBuffer;
	TInt listfilesize;
	TInt returnCode;
	RFs fileSystem;				//For file operation create a file system
	TBuf8<256> testData;			//To hold the test descriptor
	_LIT(KLogFile, "c:\\logs\\log.txt"); // log file name and path

	_LIT8(KTestMessageOne,"TEST 15.01: The value of test integer variable :%d");
	testData.Format(KTestMessageOne,100);

	User::LeaveIfError(fileSystem.Connect());
	
	//Open the file in the read mode
	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 

	
	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
	CleanupStack::PushL(hBuffer);
	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer read from file

	// Read from position 0: starting of file
	returnCode = theFile.Read(ptrString);
	
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
									//from the file

	theFile.Close();
	fileSystem.Close();
	CleanupStack::PopAndDestroy(hBuffer);
	if (returnCode > 0)
		return KErrNone;
	else 
		return KErrNotFound;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:39,代码来源:step_015_xx.cpp

示例4: BuildProfilesL

void CExampleCpiManager::BuildProfilesL(TEntry& aEntry, CExampleCpiManager::TCpiType aCpiType)
/**	Appends the Profile and Profile-Diff data discovered to an array of Profile and
	Profile-Diff data respectively
	@since		8.0
	@param		aEntry The CPI file to extract the Profile or Profile-Diff data from
	@param		aCpiType The type of CPI the file contains i.e. Profile or Profile-Diff
*/
	{
	RFile cpiFile;
	User::LeaveIfError(cpiFile.Open(iFs, aEntry.iName, EFileShareExclusive));
	CleanupClosePushL(cpiFile);
	
	TInt fileSize = 0;
	User::LeaveIfError(cpiFile.Size(fileSize));

	HBufC8* fileReader = HBufC8::NewLC(fileSize);
	TPtr8 dataBuffer = fileReader->Des();
	// Start reading from the file following the 2 UIDs found at the beginning of the file
	cpiFile.Read(KFileUIDLength, dataBuffer);
	HBufC8* cpiData = dataBuffer.AllocLC();

	switch(aCpiType)
		{
		case EProfile:
			{
			User::LeaveIfError(iProfileData.Append(cpiData));
			break;
			}
		case EProfileDiff:
			{
			User::LeaveIfError(iProfileDiffData.Append(cpiData));
			break;
			}
		default:
			break;
		}
	CleanupStack::Pop(cpiData);
	CleanupStack::PopAndDestroy(2, &cpiFile); // fileReader, cpiFile
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:39,代码来源:examplecpimanager.cpp

示例5: LoadCertDataL

HBufC8* CSWICertStoreTool::LoadCertDataL(const TDesC8& aPath)
	{
	HBufC* aBuf = HBufC::NewLC(aPath.Length());
	TPtr path(aBuf->Des());
	CnvUtfConverter::ConvertToUnicodeFromUtf8(path,aPath);

	RFile file;
	User::LeaveIfError(file.Open(iFs, path, EFileRead | EFileShareExclusive));
	CleanupClosePushL(file);

	TInt size;
	User::LeaveIfError(file.Size(size));

	HBufC8* buf = HBufC8::NewLC(size);
	TPtr8 ptr = buf->Des();
	User::LeaveIfError(file.Read(ptr, size));
	
	CleanupStack::Pop(buf);
	CleanupStack::PopAndDestroy(&file);
	CleanupStack::PopAndDestroy(aBuf);
	return buf;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:22,代码来源:CSWICertStoreTool.cpp

示例6: ConvertFileToPrivateL

void CRecogStep::ConvertFileToPrivateL()
	{
	// Read source file
	RFile fromFile;	
	User::LeaveIfError(fromFile.Open(iTheFs, iFileName, EFileShareReadersOrWriters | EFileRead | EFileStream));
	CleanupClosePushL(fromFile);
	TInt size;
	User::LeaveIfError(fromFile.Size(size));
	HBufC8* memForFileContents = HBufC8::NewLC(size);
	TPtr8 fileContents(memForFileContents->Des());		
	User::LeaveIfError(fromFile.Read(fileContents, size));
	
	// Create destination path
	TDriveUnit sysDrive = RFs::GetSystemDrive();
	(void)iTheFs.CreatePrivatePath(static_cast<TInt> (sysDrive));
	TFileName newFileName;
	User::LeaveIfError(iTheFs.PrivatePath(newFileName));
	newFileName.Insert(0, sysDrive.Name());
	TParsePtr parseFrom(iFileName);
	newFileName.Append(parseFrom.NameAndExt());

	// Make sure destination does not already exist.
	(void) iTheFs.Delete(newFileName);

	// Copy file to private location
	RFile toFile;
	User::LeaveIfError(toFile.Create(iTheFs, newFileName, EFileShareExclusive | EFileWrite | EFileStream));
	CleanupClosePushL(toFile);

	User::LeaveIfError(toFile.Write(fileContents));

	// Update iFileName
	iFileName = newFileName;
	
	// Cleanup
	CleanupStack::PopAndDestroy(&toFile);
	CleanupStack::PopAndDestroy(memForFileContents);
	CleanupStack::PopAndDestroy(&fromFile);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:39,代码来源:trecogstep.cpp

示例7: HandlePreparedAllBuddiesPresenceL

// ---------------------------------------------------------------------------
// CPresenceCacheClient::HandlePreparedAllBuddiesPresenceL()
// ---------------------------------------------------------------------------
//
void CPresenceCacheClient::HandlePreparedAllBuddiesPresenceL(TInt aError)
    {
    TInt status = aError; // size comes in status
    CPresenceBuddyInfoListImp* buddyInfoList(NULL);
    if(status>0) // if anything found
        {
        buddyInfoList = CPresenceBuddyInfoListImp::NewLC(KNullDesC);    
        HBufC8* buddyInfosDes = HBufC8::NewLC(status);                        
        TPtr8 ptrBuf( buddyInfosDes->Des() );                        
                               
        status = SendReceive( NRequest::EGetLastAsyncPreparedPacket, TIpcArgs(&ptrBuf) );
        
        TXIMPObjectPacker< CPresenceBuddyInfoListImp >::UnPackL( *buddyInfoList, *buddyInfosDes );
        CleanupStack::PopAndDestroy(buddyInfosDes);
        CleanupStack::Pop(buddyInfoList); // ownership will transfer to client
        }
    
    if(iReadHandler)
        iReadHandler->HandlePresenceReadL(status, buddyInfoList);
    else if(buddyInfoList) // if failed to transfer ownership and created object
        delete buddyInfoList; 
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:26,代码来源:presencecacheclient.cpp

示例8: StringToHexLC

HBufC8* CUPSDbManagementStep::StringToHexLC(const TDes8 &aString)
/**
 * Function to convert the contents of a TDes8 into a Hexadecimal format
 *
 * @param  - cosnt TDes8 aString: String to convert into Hexadecimal
 * @return - HBufC8*: Converted Hexadecial string representation
 **/
	{
	HBufC8* parsedString = HBufC8::NewLC(aString.Length()*2);
	TBuf8<2> pair;
	_LIT8(KFormatHex,"%02x"); 
		
	TPtr8 ptr(parsedString->Des());
   	for(TInt i = 0; i<aString.Length() ; i++)
    	{
		TInt num  = (aString)[i];
    	pair.Format(KFormatHex,num);
    	ptr.Append(pair);
    	}
	    
	return parsedString;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:22,代码来源:tupsdbmanagementstep.cpp

示例9: ReadFromFile

void CRuleManager::ReadFromFile(RFile& file)
	{
	TInt size;
	file.Size(size);
	
	HBufC8* text = HBufC8::NewL(size);
	TPtr8 ptr = text->Des();
	file.Read(ptr);

	TInt pos = ptr.Locate(KCharRuleSymbolEnd);
	while (pos != KErrNotFound)
		{
		CRule* rule = CRule::NewL();
		ReadFromFile(ptr,pos,rule);
		iRules->Append(rule);
		
		ptr.Delete(0,pos+1);
		pos = ptr.Locate(KCharRuleSymbolEnd);
		}

	delete text;
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:22,代码来源:RuleManager.cpp

示例10: SetBackgroundItemsL

// ---------------------------------------------------------------------------
// Sets display bqckground items
// ---------------------------------------------------------------------------
//    
void CAlfSrvDisplaySubSession::SetBackgroundItemsL( const RMessage2& aMessage )
    {
    CAlfAppSrvSession& session = static_cast<CAlfAppSrvSession&>(Session());
    
    // Parse parameters
    HBufC8* buffer = HBufC8::NewLC(aMessage.GetDesLength(1));
    TPtr8 ptr = buffer->Des();
    aMessage.Read(1, ptr);

    RArray<TAlfDisplayBackgroundItem> array;
    CleanupClosePushL( array );
    InternalizeL(*buffer, array);

    // Store value for this client
    iBackgroundItems.Reset();
    for(TInt i = 0; i < array.Count(); ++i)
        {
        TAlfDisplayBackgroundItem alfItem = array[i];
        THuiDisplayBackgroundItem* huiItem = (THuiDisplayBackgroundItem*)&alfItem;
        iBackgroundItems.Append(*huiItem);
        }

    CleanupStack::PopAndDestroy( &array );

    // Reset full background to none
    iDisplayClearBackground = CHuiDisplay::EClearNone;

    // Update value if the client is on focus
    if ( session.IsFocused() )
        {        
        // Set use background items
        Display().SetBackgroundItemsL(iBackgroundItems);    
        }
    
    CleanupStack::PopAndDestroy( buffer );
    
    // Complete
    aMessage.Complete( KErrNone );    
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:43,代码来源:alfsrvdisplaysubsession.cpp

示例11: ReadDataOwnersFromDiskL

	void CStorageManager::ReadDataOwnersFromDiskL(RDataOwnerArray& aArray)
		/**
		Reads Data Owners from a storage

		@param aArray - RDataOwnerArray will contain dataowners found in storage

		*/

		{
		aArray.ResetAndDestroy();
		CDir* dir = NULL;
		TFileName filename = iBackupDirName;
		filename.Append(KDataOwnerDir);
		User::LeaveIfError(iTestStep->Fs().GetDir(filename, KEntryAttMaskSupported, ESortByName, dir));
		TInt totalFiles = dir->Count();

		for (TInt index = 0; index < totalFiles; index++)
			{
			TFileName file = filename;
			TEntry entry = (*dir)[index];
			file.Append(entry.iName);
			HBufC8* data = HBufC8::NewLC(entry.iSize);
			TPtr8 pData = data->Des();
			TBool ignore;
			TRAPD(err, ReadFromDiskL(file, pData, ignore));
			if (err != KErrNone)
				{
				_LIT(KLog1, "Error opening file: ");
				iTestStep->LogWithText(LOG_LEVEL2, KLog1, file);
				CleanupStack::PopAndDestroy(data);
				continue;
				}
			CDataOwnerInfo* dataOwner = CDataOwnerInfo::NewL(pData);
			CleanupStack::PushL(dataOwner);
			aArray.AppendL(dataOwner);
			CleanupStack::Pop(dataOwner);
			CleanupStack::PopAndDestroy(data);
			}
		}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:39,代码来源:t_storagemanager.cpp

示例12: WriteAllL

void CMyXmlEle::WriteAllL(CSenElement* aXml)
{
      RFs fss;
       User::LeaveIfError(fss.Connect());
        CleanupClosePushL(fss);
        
    TBuf<255> file;
    _LIT( KFileName, "e:\\testing\\data\\normalizer%d.xml");
    file.Format(KFileName, count);
    count++;
    TPtrC OutputFile(file);
    
   RFile  xmlFile;
   xmlFile.Replace(fss , OutputFile, EFileWrite );
   HBufC8* temp = aXml->AsXmlL();
   xmlFile.Write(temp->Des());
   xmlFile.Close();
   delete temp;
    
   CleanupStack::PopAndDestroy(1); // fss

}
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:22,代码来源:myxml.cpp

示例13: TestUtcAlarmDataFunctionalityL

static void TestUtcAlarmDataFunctionalityL()
{
    TheAlarmTest.Test().Next(_L("Test alarm data functionality"));

    time.HomeTime();
    time += TTimeIntervalMinutes(1);
    id = AddUtcAlarm(time);

    _LIT8(KAlarmData, "some 8-bit data to attach to the alarm");

    ret = TheAlarmTest.Session().AlarmDataAttachL(id, KAlarmData());
    TheAlarmTest(ret == KErrNone, __LINE__);
    ret = TheAlarmTest.Session().AlarmDataSize(id);
    TheAlarmTest(ret > 0, __LINE__);

    HBufC8* temp = HBufC8::NewLC(KAlarmData().Size());
    TPtr8 pData(temp->Des());
    ret = TheAlarmTest.Session().GetAlarmData(id, pData);
    TheAlarmTest(ret == KErrNone, __LINE__);
    TheAlarmTest(pData.CompareC(KAlarmData()) == 0, __LINE__);
    CleanupStack::PopAndDestroy(temp);
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:22,代码来源:TOomTest.cpp

示例14: FillEventBodyL

// -----------------------------------------------------------------------------
// CUpnpEventQueueManagerBase::CreateEventL
// -----------------------------------------------------------------------------
//
HBufC8* CUpnpEventQueueManagerBase::CreateEventL
                        ( const RPointerArray<CUpnpStateVariable>& aVariableList )
    {      
    HBufC8* body = HBufC8::NewLC( KMaxGenaMessageLength );        
    TPtr8 bodyPtr = body->Des(); 
    bodyPtr.Zero();
    bodyPtr.Append( KGenaXml );
    bodyPtr.Append( KGenaPropertysetStart );
    
    TInt eventableVariableCount = FillEventBodyL( bodyPtr, aVariableList ); 
    if ( eventableVariableCount > 0 )
        {        
        bodyPtr.Append( KGenaPropertysetEnd );
        CleanupStack::Pop( body );
        return body;
        }
    else
        {
        CleanupStack::PopAndDestroy( body );
        return KNullDesC8().AllocL();             
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:26,代码来源:upnpeventqueuemanagerbase.cpp

示例15: EncodeValueL

// -----------------------------------------------------------------------------
// CNATFWUNSAFChangeRequestAttribute::EncodeValueL
// -----------------------------------------------------------------------------
//
HBufC8* CNATFWUNSAFChangeRequestAttribute::EncodeValueL() const
    {
    HBufC8* encodedValue = HBufC8::NewLC(EAttributeValueSize);

    TPtr8 ptr = encodedValue->Des();
    ptr.FillZ(EAttributeValueSize);

    TUint32 value(0);
    if (ChangeIP())
        {
        value = value | EChangeIPMask;
        }
    if (ChangePort())
        {
        value = value | EChangePortMask;
        }

    NATFWUNSAFUtils::WriteNetworkOrder32L(ptr, 0, value);

    CleanupStack::Pop(encodedValue);
    return encodedValue;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:26,代码来源:natfwunsafchangerequestattribute.cpp


注:本文中的HBufC8::Des方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。