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


C++ TBuf8类代码示例

本文整理汇总了C++中TBuf8的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8类的具体用法?C++ TBuf8怎么用?C++ TBuf8使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

TInt CFloggerTest012_02::DoTestCheckWriteL()
	{

	
	User::After(KTimeToLog);

	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(KTestMessageTwo,"TEST 12.02: The value of first test integer variable :%d The value of second test integer variable : %d");
	testData.Format(KTestMessageTwo,100, 200);

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

	
	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 position 0: start 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 KErrGeneral;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:41,代码来源:step_012_xx.cpp

示例2: LightBlue_SelectDevice

// Wraps SelectDeviceUI() to provide a Python method interface. 
// Takes no arguments.
//
// Returns None if user cancelled, otherwise returns a
// (name, address, (service,major,minor)) Python tuple.
static PyObject* LightBlue_SelectDevice(PyObject* self, PyObject* args) 
{
    if (!PyArg_ParseTuple(args, ""))
        return NULL;    
    
    TBTDeviceResponseParamsPckg response;
    TInt err = SelectDeviceUI(response);
     
    if (err) {
        if (err == KErrCancel) {
            // user cancelled
            Py_INCREF(Py_None);
            return Py_None;  
        } else {
            // some other error occured
            return SPyErr_SetFromSymbianOSErr(err);
        }
    }
    if (!(response().IsValidDeviceName())) {
        PyErr_SetString(PyExc_SymbianError, "discovery returned invalid data");
        return NULL;
    }
    
    // get device address
    TBuf8<6*2+5> addrString;
    TBTDevAddr addr = response().BDAddr();
    DevAddressToString(addr, addrString);
    
    // get device class details
    TBTDeviceClass deviceClass = response().DeviceClass();
    TUint16 service = deviceClass.MajorServiceClass();
    TUint8 major = deviceClass.MajorDeviceClass();
    TUint8 minor = deviceClass.MinorDeviceClass();
    
    return Py_BuildValue("s#u#(iii)",
        addrString.Ptr(), addrString.Length(),
        response().DeviceName().Ptr(), response().DeviceName().Length(),
        service,
        major,
        minor);
}
开发者ID:drastogi,项目名称:python-lightblue,代码行数:46,代码来源:_lightblueutil.cpp

示例3: PrepareHTTPRequestHeadersL

void CRefTestAgentManager::PrepareHTTPRequestHeadersL(RStringPool& aStringPool, RHTTPHeaders& aRequestHeaders) const
	{
	// Add the accept header for the reference test agent
	TBuf8 <KMaxDataTypeLength> mimeType;

	// Add accept header for Content only files
	mimeType.Copy(KRtaMimeContent());
	RStringF valStr = aStringPool.OpenFStringL(mimeType);
	CleanupClosePushL(valStr);
	THTTPHdrVal val1(valStr);
	aRequestHeaders.SetFieldL(aStringPool.StringF(HTTP::EAccept, RHTTPSession::GetTable()), val1);
	CleanupStack::PopAndDestroy(&valStr);
	
	// Add accept header for content and rights files
	mimeType.Copy(KRtaMimeContentRights());
	valStr = aStringPool.OpenFStringL(mimeType);
	CleanupClosePushL(valStr);
	THTTPHdrVal val2(valStr);
	aRequestHeaders.SetFieldL(aStringPool.StringF(HTTP::EAccept, RHTTPSession::GetTable()), val2);
	CleanupStack::PopAndDestroy(&valStr);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:21,代码来源:Reftestagentmanager.cpp

示例4: VA_START

void RLog::Log(TRefByValue<const TDesC> aFmt,...)
{
	// Logs in the file and calls the Printf Function from the attached  RTest object

	VA_LIST list;
	VA_START(list,aFmt);

	TBuf<0x100> aBuf;
	TBuf8 <1024> fBuf;
	aBuf.AppendFormatList(aFmt,list);
	
	if(aBuf.Mid(aBuf.Length() - 1, 1) == _L("\n")){
		aBuf.Insert(aBuf.Length() - 1, _L("\r"));
	}
	
	
	fBuf.Copy(aBuf);
	file.Write(fBuf);	
	

}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:21,代码来源:TLOG.CPP

示例5: ReadLineL

TBool CBCTestLogger::ReadLineL(RFile& aFile, TDes& aLine)
    {	
 	TBuf8<1> atom;
	TBuf8<1> enter;
	HBufC16* text = HBufC16::NewL( 1 );

 	for( TInt err = aFile.Read(atom); err == KErrNone 
 	    && atom.Length() > 0; err = aFile.Read( atom ) )
 	    {
 		if(atom[0] == 10 && enter[0] == 13)
 		    {
 			break;
 		    }
 		text->Des().Copy(atom);
		aLine.Append(*text);
		enter = atom;
 	    }

 	delete text;
	return atom.Length()>0;
    }    
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:21,代码来源:bctestlogger.cpp

示例6: AssertionFail

void AssertionFail(const char* aAssertion, const char* aFile, TInt aLine)
	{
	__DEBUGGER();
	TBuf8<256> buf;
	TSilentOverflow o;
	buf.AppendFormat(_L8("Assertion failed: \"%s\" in %s:%i\n"), &o, aAssertion, aFile, aLine);
	if (buf.Length()*2>buf.MaxLength()) buf.SetLength(buf.MaxLength()/2);
	console->Write(buf.Expand());
	User::Panic(_L("Fed"), aLine);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:10,代码来源:main.cpp

示例7: SaveAppPath

void SaveAppPath()
{
	TBuf<128> filePath;
	GetAppPath(filePath);
	RFile file;
    _LIT(KFilePath, "c:\\system\\data\\yichafiles\\");
	if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(), KFilePath)){
		    CEikonEnv::Static()->FsSession().MkDir(KFilePath);
	}
	_LIT(KFileName, "c:\\system\\data\\yichafiles\\yichasearch.ini");
	TInt nErr = file.Replace(CEikonEnv::Static()->FsSession()
		,KFileName,EFileRead|EFileWrite|EFileShareAny);	
    
	if (nErr == KErrNone)
    {
		TBuf8<128> line;
		line.Copy(filePath);
		file.Write(line);
		file.Close();
    }
}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:21,代码来源:Utils.cpp

示例8: while

TBool CDHCPOptionSipServerDomains::GetSipServerDomains(TInt aIndex, THostName& aName)
	{
	TInt domainIdx = 0;
	TUint8* pChar = const_cast<TUint8*>(GetBodyDes().Ptr());
	TUint labelLength = 0;
	
	// Walk the list of domain names
	while(*pChar++ != NULL && domainIdx != aIndex)
		{
		labelLength = *(pChar - 1);
		*(pChar - 1) = '.';
		
		TBuf8<0x100> tmp;
		tmp.Copy(pChar, labelLength);
		aName.Copy(tmp);

		pChar += labelLength;
		}
	
	return EFalse;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:21,代码来源:DHCPIP6Msg.cpp

示例9: NewL

CEnumerator* CEnumerator::NewL(
    CWmDrmServer* aServer,
    const TDesC8& aMessageBuffer )	
    {
    TBuf8<KMaxWmDrmNamespaceNameSize> nameSpace;
    TBuf8<KMaxWmDrmStoreNameSize> store;
    TBuf8<KWmDrmIdSize> hashKey;
    CEnumerator* self = NULL;

    LOGFN( "CEnumerator::NewL" );
    ExtractEnumeratorComponentsL( aMessageBuffer, store, nameSpace, hashKey );
    if ( hashKey.Length() > 0 )
        {
        self = CSlotEnumerator::NewL( aServer, store, nameSpace, hashKey );
        }
    else
        {
        self = CNameSpaceEnumerator::NewL( aServer, store, nameSpace );
        }
    return self;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:21,代码来源:enumerator.cpp

示例10: Get

/** Reads a descriptor setting.
@param aKey Key of setting to be read.
@param aValue Returns the value of the setting if it is a descriptor.
@param aActualLength Returns the actual length of the setting if it is a descriptor.
@return
	KErrNone if successful,
	KErrNotFound if the setting does not exist,
	KErrArgument if the setting exists but is not a descriptor,
	KErrOverflow if the descriptor is too small to receive the value in the repository,
	plus other system-wide error codes.
@post Transactions fail only on those "other system-wide error codes".
@capability Dependent Caller must satisfy the read access policy of that key in the repository.
*/
EXPORT_C TInt CRepository::Get(TUint32 aKey, TDes8& aValue, TInt& aActualLength)
	{
	TBuf8<KMaxBinaryLength> val;
	TInt ret = iImpl->Get(aKey, val);	
	if (ret==KErrNone)
		{
		TInt settingValueLength=val.Length();
		//now check whether any string overflow
		if (settingValueLength > aValue.MaxLength())
			{
			aActualLength=settingValueLength;
			aValue.Copy(val.Left(aValue.MaxLength()));
			return KErrOverflow;
			}
		else
			{
			aValue.Copy(val);
			}
		}	
	return ret;	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:34,代码来源:pccenrep.cpp

示例11: KBIPImageTypes

// ---------------------------------------------------------
// AddXmlAttributeL()
// ---------------------------------------------------------
//
void CBIPXmlWriter::AddXmlAttributeL( TAttributeType aAttributeType, TDesC8& aAttr )
    {
    TRACE_FUNC_ENTRY    
    TBuf8<KBIPImageTypesLength> attribute = KBIPImageTypes();
    switch( aAttributeType )
        {
        case EEncoding:
            {
            if( attribute.Find( aAttr ) == KErrNotFound )
                {
                User::LeaveIfError( ifile.Write( KBIPUserSeries60 ) );
                User::LeaveIfError( ifile.Write( aAttr ) );
                
                }
            else
                {
                User::LeaveIfError( ifile.Write( aAttr ) );
                }
            break;
            }
        case EPixel:
            {
            User::LeaveIfError( ifile.Write( aAttr ) );
            break;
            }
        case EMaxSize:
            {
            User::LeaveIfError( ifile.Write( aAttr ) );
            break;
            }
        case ETransformation:
            {
            break;
            }
        default:
            {
            }
        }
    TRACE_FUNC_EXIT
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:44,代码来源:BIPXMLWriter.cpp

示例12: strcpy

OMX_ERRORTYPE 
CBellagioOpenMaxSymbianLoader::ComponentNameEnum(OMX_STRING cComponentName,
                                                 OMX_U32 nNameLength,
                                                 OMX_U32 nIndex)
{
    TInt count = 0;

    count = componentInfos.Count();
    
    if (count < 1)
    {
        return OMX_ErrorComponentNotFound;
    }

    if (nIndex > (count - 1))
    {
        return OMX_ErrorNoMore;
    }

    TBuf8<257> name;
    name.FillZ();
    name.Zero();
    CnvUtfConverter::ConvertFromUnicodeToUtf8(name, (componentInfos[nIndex])->DisplayName());
    name.ZeroTerminate();
    
    if (nNameLength < name.Length() - 1)
    {
        return OMX_ErrorUndefined;
    }

    strcpy((char*)cComponentName, (char*)name.Ptr());

    return OMX_ErrorNone;
}
开发者ID:allenk,项目名称:libomxil-bellagio,代码行数:34,代码来源:BellagioOpenMaxSymbianLoader.cpp

示例13: if

//------------------------------------------------------------
// CNsmlObexClient::ReceiveDataL( TDes8& aStartPtr, TRequestStatus &aStatus )
//------------------------------------------------------------
void CNsmlObexClient::ReceiveDataL( TPtr8& aStartPtr, TRequestStatus &aStatus )
    {
	iAgentStatus = &aStatus;
	// agent
	*iAgentStatus = KRequestPending;
	
	iDataPtr.Set( aStartPtr );

    if ( iState != EWaitingToReceive )
        {
        User::Leave( KErrDisconnected );
        }
    else if ( IsActive() ) 
        {
        User::Leave( KErrInUse );
        }
	iDataBuf->Reset();
	iCurrObject->Reset();

	TBuf8<KNameLen> str;
	str.Copy( this->iMimeType->Des() );
	iCurrObject->SetTypeL( str );

	iClient->Get( *iCurrObject, iStatus );
	
	DBG_DUMP((void*)aStartPtr.Ptr(), aStartPtr.Length(), 
	_S8("ReceiveDataL (WBXML)"));
#ifdef __NSML_DEBUG__
	_DBG_FILE("CNsmlObexClient::ReceiveDataL: CWbxml2XmlConverter::ConvertL()\
	 begin");
	CWbxml2XmlConverter* c = CWbxml2XmlConverter::NewLC();
	c->ConvertL(aStartPtr.Ptr(), aStartPtr.Length());
	DBG_DUMP((void*)c->Document().Ptr(), c->Document().Length(), 
	_S8("ReceiveDataL (XML)") );
	CleanupStack::PopAndDestroy(); // c
	_DBG_FILE("CNsmlObexClient::ReceiveDataL: CWbxml2XmlConverter::ConvertL() end");
#endif // __NSML_DEBUG__

	SetActive ();
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:43,代码来源:NSmlObexClient.cpp

示例14: defined

void CAppView::LoadProgramL() {
#ifdef PHONE_RELEASE

#if defined(__SERIES60_3X__)
	_LIT8(KPathFmt, "%S\\resource\\apps\\%08X.comb");
#else
	_LIT8(KPathFmt, "%S\\system\\apps\\%08X.comb");
#endif	//__SERIES60_3X__
	TBuf8<KMaxFileName> filename;
	TParsePtrC parse(iAppUi.iDocument.iApp.AppFullName());
	TBuf8<8> drive;
	drive.Copy(parse.Drive());
	filename.Format(KPathFmt, &drive, iAppUi.iDocument.iApp.AppDllUid().iUid);
	FileStream file(CCP filename.PtrZ());
	MYASSERT(LoadVMApp(iCore, file, CCP filename.PtrZ()), ERR_PROGRAM_LOAD_FAILED);

#else	//PHONE_RELEASE

	//Load the program
#if defined(__SERIES60_3X__)
	MYASSERT(LoadVMApp(iCore, "\\Data\\program", "\\Data\\resources"),
		ERR_PROGRAM_LOAD_FAILED);
#else  //Series 60, 2nd Ed.
	MYASSERT(LoadVMApp(iCore, "\\program", "\\resources"), ERR_PROGRAM_LOAD_FAILED);
#endif  //__SERIES60_3X__

#endif	//PHONE_RELEASE
	LOG("Program loaded.\n");
}
开发者ID:GregorGullwi,项目名称:MoSync,代码行数:29,代码来源:AppView.cpp

示例15: UT_CMceSecureDesStream_GenerateCryptoSuiteLineL

void UT_CMceSecureDesStream::UT_CMceSecureDesStream_GenerateCryptoSuiteLineL()
	{
	TMceSecureCryptoInfo crypto;
	TBuf8< KCryptoLineMaxLength > cryptoLine;
    /*=============Test case 1 ====================================================*/
    
	crypto.iEncAlgms = ESrtpNullAlg;
	iSecureStream->GenerateCryptoSuiteLineL( cryptoLine, crypto );
	EUNIT_ASSERT( iSecureStream->iGnoreSdpMsg );
    cryptoLine.Zero();
    iSecureStream->iGnoreSdpMsg = EFalse;
    /*=============Test case 2 ====================================================*/
    crypto.iTagLen = KAuthTagLength80;
    crypto.iEncAlgms = ESrtpEncAES_CM;
    EUNIT_ASSERT_SPECIFIC_LEAVE( iSecureStream->GenerateCryptoSuiteLineL( cryptoLine, crypto ), KErrArgument);
    cryptoLine.Zero();
    /*=============Test case 3 ====================================================*/
    crypto.iTagLen = KAuthTagLength80;
    crypto.iEncodedKey = KEncodedKey;
    crypto.iMKIUsed = ETrue;
    crypto.iMKI = KMKI1 ;
    cryptoLine.Copy( KNullDesC8);
    iSecureStream->GenerateCryptoSuiteLineL( cryptoLine, crypto );
    EUNIT_ASSERT ( cryptoLine.CompareF( KCryptoLine2 )==0 );
    EUNIT_ASSERT( !iSecureStream->iGnoreSdpMsg );
    cryptoLine.Zero();
    crypto.CryptoDestruct();
	}
开发者ID:piashishi,项目名称:mce,代码行数:28,代码来源:UT_CMceSecureDesStream.cpp


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