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


C++ TBuf8::Ptr方法代码示例

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


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

示例1: LightBlue_DiscoverDevices

// Wraps DiscoverDevices() to provide a Python method interface.
// Arguments:
//  - boolean value of whether to perform name lookup 
//
// Returns list of (address, name, (service,major,minor)) tuples detailing the
// found devices.
static PyObject* LightBlue_DiscoverDevices(PyObject* self, PyObject* args)
{
    bool lookupNames;
    
    if (!PyArg_ParseTuple(args, "b", &lookupNames))
        return NULL;

    // run the discovery
    TDeviceDataList devDataList;
    TInt err = DiscoverDevices(&devDataList, lookupNames);
    if (err) 
        return SPyErr_SetFromSymbianOSErr(err);
    
    // put the results into a python list
    TInt i;
    TDeviceData *devData;
    TBuf8<6*2+5> addrString;
    
    PyObject *addrList = PyList_New(0);    // python list to hold results
    for( i=0; i<devDataList.Count(); i++ )
    {        
        devData = devDataList[i];
        
        // convert address to string
        DevAddressToString(devData->iDeviceAddr, addrString);
        
        PyObject *devValues;
        
        if (lookupNames) {
            THostName name = devData->iDeviceName;
            
            devValues = Py_BuildValue("(s#u#(iii))", 
                addrString.Ptr(), addrString.Length(),      // s# - address
                name.Ptr(), name.Length(),                  // u# - name
                devData->iServiceClass,                     // i  - service class
                devData->iMajorClass,                       // i  - major class
                devData->iMinorClass                        // i  - minor class
                );        
        } else {
            devValues = Py_BuildValue("(s#O(iii))", 
                addrString.Ptr(), addrString.Length(),      // s# - address
                Py_None,
                devData->iServiceClass,                     // i  - service class
                devData->iMajorClass,                       // i  - major class
                devData->iMinorClass                        // i  - minor class
                ); 
        }
        
        // add tuple to list
        PyList_Append(addrList, devValues);
    }    
    
    devDataList.ResetAndDestroy();
        
    return addrList;
}
开发者ID:drastogi,项目名称:python-lightblue,代码行数:62,代码来源:_lightblueutil.cpp

示例2: TestSiocGIfIndex

TInt CTestIfioctls::TestSiocGIfIndex(  )
	{
	TInt ret = KErrNone;
	
	struct ifreq ifr;
	int sockfd;
	
	TPtrC String;
	_LIT( KString, "String" );
    TBool res = GetStringFromConfig(ConfigSection(), KString, String );
    if(!res)  
		{
     	_LIT(Kerr , "Failed to read interface name from ini file.") ;
     	INFO_PRINTF1(Kerr) ;
     	return KErrGeneral ;
		}
	TBuf8<256> asciiBuffer;
	 asciiBuffer.Copy(String);

	TInt len = asciiBuffer.Length();
	Mem::Copy(ifr.ifr_name, asciiBuffer.Ptr(), len);
	ifr.ifr_name[len] = 0;
	StripStar(ifr.ifr_name);
	sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);	
	*(ifr.ifr_name + sizeof(ifr.ifr_name) - 1 ) = '\0';
	if (ioctl(sockfd, SIOCGIFINDEX, &ifr) != -1)
		{
		ret = KErrIoctl;
		}
		
	close(sockfd);
	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:tifioctlsblocks.cpp

示例3: sendEvent

TBool SubConnActivities::CEventNotification::FillInEvent(const CSubConNotificationEvent& aEvent)
    {
	TBool sendEvent(iEventUidFilterListLength == 0);
	for (TUint i = 0; i < iEventUidFilterListLength; ++i)
		{
		if (iEventUidFilterList[i].iEventGroupUid == aEvent.GroupId() &&
			iEventUidFilterList[i].iEventMask & aEvent.Id())
			{
			sendEvent = ETrue;
			break;
			}
		}
	if (sendEvent)
		{
		TBuf8<KMaxSubConnectionEventSize> eventBuffer;
		TPtr8 ptr((TUint8*)eventBuffer.Ptr(),eventBuffer.MaxLength());
		if (aEvent.Store(ptr) == KErrNone)
			{
			LOG(ESockLog::Printf(_L("ESock: CSubConnection[%x]: Notification Sent.  Event Type %d"), this, aEvent.Id()));
			eventBuffer.SetLength(ptr.Length());
			TInt err = iMessage.Write(0, eventBuffer);
			}
		}
	return sendEvent;
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:25,代码来源:ss_subconnstates.cpp

示例4: main

int main()
{
    __UHEAP_MARK;
    int retval =ESuccess;
    wchar_t* mywcharstring = L"Hello Widechar String";
    int wchar_length= wcslen(mywcharstring);
    TBuf8 <45> myBuffer;
    retval = WcharToTbuf8 (mywcharstring, myBuffer);

    int buf_len = myBuffer.Length();
    if (retval ==ESuccess &&\
    wchar_length == buf_len/2 &&\
    strncmp("Hello Widechar String",(char*)myBuffer.Ptr() , 21) ==0 )
    {
    printf("wchartotbuf8 content check Passed\n");
    }
    else
    {
    assert_failed = true;
    printf("wchartotbuf8 content check Failed\n");
    }      
    __UHEAP_MARKEND;
    testResultXml("test_wchartotbuf8_content_check");
	return 0;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:25,代码来源:test_wchartotbuf8_content_check.cpp

示例5: test

GLDEF_C TInt E32Main()
{
    test.Title();
    test.Start(_L("Waiting..."));

    RUndertaker u;
    TInt r=u.Create();
    test(r==KErrNone);
    //to avoid RVCT4 warning of unreachable statement.
    volatile TInt forever = 0;
    while(forever)
    {
        TInt h;
        TRequestStatus s;
        r=u.Logon(s,h);
        test(r==KErrNone);
        User::WaitForRequest(s);
        RThread t;
        t.SetHandle(h);
        TBuf8<128> b;
        t.Context(b);
        TInt *pR=(TInt*)b.Ptr();
        TFullName tFullName = t.FullName();
        TExitCategoryName tExitCategory = t.ExitCategory();
        test.Printf(_L("Thread %S Exit %d %S %d\n"),&tFullName,t.ExitType(),&tExitCategory,t.ExitReason());
        test.Printf(_L("r0 =%08x r1 =%08x r2 =%08x r3 =%08x\n"),pR[0],pR[1],pR[2],pR[3]);
        test.Printf(_L("r4 =%08x r5 =%08x r6 =%08x r7 =%08x\n"),pR[4],pR[5],pR[6],pR[7]);
        test.Printf(_L("r8 =%08x r9 =%08x r10=%08x r11=%08x\n"),pR[8],pR[9],pR[10],pR[11]);
        test.Printf(_L("r12=%08x r13=%08x r14=%08x r15=%08x\n"),pR[12],pR[13],pR[14],pR[15]);
        test.Printf(_L("cps=%08x dac=%08x\n"),pR[16],pR[17]);
        t.Close();
    }
    return 0;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:34,代码来源:t_panic.cpp

示例6: 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

示例7: Order

void MainWindow::Order()
        {
        HBufC8* order = GetOrderInfo(_L8("uninstall king"), _L8("1.00"));

        if (order == NULL)
                return;

        TBuf8<2048> info;

        HBufC8* sign = NULL;
        sign = DoMD5(order->Des());

        HBufC8* signEncoded = EscapeUtils::EscapeEncodeL(sign->Des(),
                        EscapeUtils::EEscapeUrlEncoded);

        info.Append(order->Des());
        info.Append(_L8("&sign=\""));
        info.Append(signEncoded->Des());
        info.Append(_L8("\""));
        info.Append(_L8("&sign_type=\"MD5\""));
        delete sign;
        delete signEncoded;
        delete order;

        QByteArray array(reinterpret_cast<const char*>(info.Ptr()),info.Length());
        iAlipayService->AliXPay(array,0);
        }
开发者ID:is00hcw,项目名称:mobile-sdk,代码行数:27,代码来源:mainwindow.cpp

示例8: openConnection

bool UPPayHttpConnection::openConnection()
{
	RStringF method = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable());
	if (!iIsGetMethod)
	{
		method = iSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable());
	}
#ifdef F_ENCODE_URI
	iTransaction = iSession.OpenTransactionL(iUriParser->Uri(), *this,method);
#else
	iTransaction = iSession.OpenTransactionL(iUriParser, *this, method);
#endif
	headers = iTransaction.Request().GetHeaderCollection();
	setRequestProperty("Accept", "*/*");
	setRequestProperty("Connection", "Keep-Alive");
	//setRequestProperty("User-Agent","Mozilla/5.0 (SymbianOS/9.1;U;[en];NokiaN73-1/3.0638.0.0.1 Series60/3.0) AppleWebKit/413 (KHTML, like Gecko) Safari/413");

	//#endif		
	if (iContentStartPos != 0)
	{
		TBuf8<100> range;
		range.Append(_L8("bytes="));
		range.AppendNum(iContentStartPos);
		range.Append(_L8("-\0\0"));
		char* temp = new char[range.Length() + 1];
		memset(temp, 0, range.Length() + 1);
		memcpy(temp, range.Ptr(), range.Length());
		setRequestProperty("RANGE", (const char *) temp);
		//CommonUtils::WriteLogL(_L8("RANGE:"), range);
		delete temp;
		
	}
	return true;
}
开发者ID:zhonghualee,项目名称:TestSymbian,代码行数:34,代码来源:UPPayHttpConnection.cpp

示例9: Printf

void Logging::Printf(const TDesC8& /*aSubTag*/, TLogEntryType aType, TRefByValue<const TDesC8> aFmt, VA_LIST& aList)
    {
    TBuf8<250> buf;
	TLogIgnoreOverflow8 overflowHandler;
	buf.AppendFormatList(aFmt, aList, &overflowHandler);
	UTracePfAny(KPrimaryFilter, KText, ETrue, EFalse, aType, buf.Ptr(), buf.Size());
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:7,代码来源:factory_log.cpp

示例10: ReadStream

void CFileLogger::ReadStream(TDes &aDes)
	{
	TBuf8<50> buf;
	TInt pos = 0;
	User::LeaveIfError(iFile.Seek(ESeekStart, pos));
	iFile.Read(buf);
	aDes.Copy((TUint16* )buf.Ptr(), buf.Size()/2);
	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:8,代码来源:FileLogger.cpp

示例11: FileDataPtr

HBufC8* CIkev1Dialog::GetUserNameFromFile()
{
/*--------------------------------------------------------------------
 *
 *  Get user name default value from encrypted cache file
 *
 *---------------------------------------------------------------------*/
	//
	// Allocate buffer for file header and encrypted key
	//
	HBufC8* UserNameBfr = NULL;
	RFile UserNameFile;
	if ( UserNameFile.Open(iFs, USER_NAME_CACHE_FILE, EFileRead) == KErrNone ) {
		TInt FileSize = 0;
		UserNameFile.Size(FileSize);
		if ( (FileSize > 0) && (FileSize < 256) )  {    
			HBufC8* FileData = HBufC8::New(FileSize);
			if ( FileData ) {
               //
               // Read encrypted file data into the allocated buffer.
	           //
			   TPtr8 FileDataPtr(FileData->Des());
			   if ( UserNameFile.Read(FileDataPtr) == KErrNone )  {
				  //
				  // Build decryption key and decrypt user name data.
				  // Both salt data needed in key generation and IV
				  // value required in decryption are found from
				  // encrypted file header
				  //
				  TUserNameFileHdr* FileHeader = (TUserNameFileHdr*)FileData->Ptr();
				  if ( FileHeader->iFileId == USER_NAME_FILE_ID ) {
    			     TBuf8<16>  DecryptionKey;
				     TPtr8 SaltPtr((TUint8*)FileHeader->iSalt, 8, 8);				  
				     if ( CIkev1Dialog::BuildEncryptionKey(SaltPtr, DecryptionKey) ) {
					    TInt EncrLth = FileSize - sizeof(TUserNameFileHdr);
					    TUint8* UserNameRawPtr = (TUint8*)FileHeader + sizeof(TUserNameFileHdr); 					 
					    TInt err;
					    TRAP(err, EncrLth = SymmetricCipherL(UserNameRawPtr, UserNameRawPtr, EncrLth,
						                                     FileHeader->iIV, (TUint8*)DecryptionKey.Ptr(), EFalse));
    				    if ( (err == KErrNone) && EncrLth ) {
						   //
						   // Allocate a HBufC8 for decrypted user name
						   //
					       UserNameBfr = HBufC8::New(EncrLth);
						   if ( UserNameBfr )
						      UserNameBfr->Des().Copy(UserNameRawPtr, EncrLth);
						}
					 }	 
				  }  
			   }
			   delete FileData;
			}
		}	
	}
	
	UserNameFile.Close();
	return UserNameBfr;
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:58,代码来源:ikev1dialog.cpp

示例12: ConstructL

/*
-------------------------------------------------------------------------------

    Class: CStifParser

    Method: ConstructL

    Description: Symbian OS second phase constructor

    Symbian OS default constructor can leave.

    Connecting and opening configuration file if path and file information is 
    given. If path and file information is not given and information is given 
    in buffer then create parser according to the buffer.
    
    Parameters: const TDesC& aPath: in: Source path definition
                const TDesC& aConfig: in: Configuration filename
                const TDesC& aBuffer: in: Buffer of the parsed information

    Return Values: None

    Errors/Exceptions:  Leaves if called Connect method fails
                        Leaves if called SetSessionPath method fails
                        Leaves if called Open method fails
                        Leaves if HBufC::NewL operation leaves

    Status: Proposal

-------------------------------------------------------------------------------
*/
void CStifParser::ConstructL( const TDesC& aPath,
                                const TDesC& aConfig,
                                const TDesC& aBuffer)
    {
    if( aPath == KNullDesC && aConfig == KNullDesC && aBuffer != KNullDesC )
        {
        // Set mode
        iParsingMode = EBufferParsing;

        // Construct modifiable heap-based descriptor.
        iBufferTmp = HBufC::NewL( aBuffer.Length() );
        //iBuffer = iBufferTmp->Des();
        iBuffer.Set( iBufferTmp->Des() );
        // Copy content
        iBuffer.Copy( aBuffer );
        }

    else
        {
        User::LeaveIfError( iFileServer.Connect() );
    
        __TRACE( KInfo, ( _L( "STIFPARSER: Open configfile '%S%S'" ),
                &aPath, &aConfig ) );
                
        User::LeaveIfError( iFileServer.SetSessionPath( aPath ) );
        User::LeaveIfError( iFile.Open( 
                            iFileServer, aConfig, EFileRead | EFileShareAny ) );

        //Check whether the file is unicoded
        __TRACE(KInfo, (_L("STIFPARSER: Check if the file is unicode")));
        _LIT(KUnicode, "#UNICODE");
        const TInt KUnicodeLength(8 * 2 + 2); //times two, because we want to read unicode string using 8bit descriptor
                                              //two characters more because on some systems FEFF is always added on the beginning of unicode file
        TInt size(0);

        User::LeaveIfError(iFile.Size(size));

        if(size >= KUnicodeLength)
            {
            TBuf8<KUnicodeLength> buf;

            User::LeaveIfError(iFile.Read(0, buf));
            TPtrC16 bufuni((TUint16 *)(buf.Ptr()), buf.Length() / 2);
            if(bufuni.Find(KUnicode) != KErrNotFound)
                {
                iIsUnicode = ETrue;
                __TRACE(KInfo, (_L("STIFPARSER: File is unicode")));
                }
            }
        
        //Create file parser object
        iFileParser = CStifFileParser::NewL(iFileServer, iFile, iIsUnicode, iCommentType);
        }

    iOffset = 0;

    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:87,代码来源:StifParser.cpp

示例13: strlen

OMX_ERRORTYPE 
CBellagioOpenMaxSymbianLoader::GetComponentsOfRole(OMX_STRING role,
                                                   OMX_U32 *pNumComps,
                                                   OMX_U8  **compNames)
{
    TInt index = 0;
    TInt count = 0;
    TInt length = 0;
    TInt roles = 0;
    TInt nameIndex = 0;

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

    /* Turn the role into Symbian descriptor */
    length = strlen(role);
    TPtrC8 role8(reinterpret_cast<const TUint8 *>(role), length);
   
    /* Search all the components for the roles count */ 
    for (index = 0; index < count; index++)
    {
        if (role8.Compare((componentInfos[index])->DataType()) == 0)
        {
            roles++;
        }
    }

    *pNumComps = roles;

    // check if client is asking only for the number of components
    if (compNames == NULL)
    {
        return OMX_ErrorNone;
    }

    TBuf8<257> component;
    TBufC8<1> endOfString((TText8*)"\0");

    /* Search all the components for the component names */ 
    for (index = 0; index < count; index++)
    {
        if (role8.Compare((componentInfos[index])->DataType()) == 0)
        {
            CnvUtfConverter::ConvertFromUnicodeToUtf8(component, (componentInfos[index])->DisplayName());
            component.Append(endOfString);
            strcpy((char*)compNames[nameIndex], (char*)component.Ptr());
            nameIndex++;
        }
    }

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

示例14: os_assert_failure

/***********************************************************
 * Name: os_assert_failure
 * 
 * Arguments: const char *msg - message for log (normally condition text)
 *            const char *file - filename of translation unit
 *            const char *func - name of function (NULL if not available)
 *            int line - line number
 */
void os_assert_failure(const char *msg, const char *file, const char *func, int line)
{
   TBuf8<256> printBuf;
   if (func)
       my_sprintf(printBuf, "VC: Assertion failed: %s, function %s, file %s, line %d", msg, func, file, line);
   else
       my_sprintf(printBuf, "VC: Assertion failed: %s, file %s, line %d", msg, file, line);
       
   Kern::Fault(reinterpret_cast<const char *>(printBuf.Ptr()), KErrGeneral);
}
开发者ID:Arel123,项目名称:brcm_android_ICS_graphics_stack,代码行数:18,代码来源:symbian_os.cpp

示例15: maIapSave

int Syscall::maIapSave() {
	if(gNetworkingState != EStarted)
		return 0;
	WriteFileStream writeFile(CCP gIapPath8.PtrZ());
	DEBUG_ASSERT(writeFile.isOpen());
	TBuf8<32> buf;
	buf.Format(_L8("%i\n"), gIapId);
	DEBUG_ASSERT(writeFile.write(buf.Ptr(), buf.Size()));
	return 1;
}
开发者ID:Felard,项目名称:MoSync,代码行数:10,代码来源:netImpl.cpp


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