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


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

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


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

示例1: assert_equals_des16

TBool assert_equals_des16(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity,
	const TDesC& aRes, const TDesC& aExp, const TDesC& aMsg)
	{
	if(aRes != aExp)
		{
		TPtrC exp;
		TPtrC res;
		
		exp.Set(aExp.Ptr(), aExp.Length());
		res.Set(aRes.Ptr(), aRes.Length());
		
		//truncate to 20 characters, to avoid logging too big strings
		if(exp.Length() > KMaxLogCharLength)
			{
			exp.Set(exp.Ptr(), KMaxLogCharLength);
			}
		
		if(res.Length() > KMaxLogCharLength)
			{
			res.Set(res.Ptr(), KMaxLogCharLength);
			}
		
		aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &res, &exp, &aMsg);
		return EFalse;
		}
	return ETrue;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:27,代码来源:cctsyintegrationtestsuitebase.cpp

示例2: OpenBlock

TInt CIniData::OpenBlock(const TDesC &aSection)
/**
Reads in the entire table section of all ADD / SET blocks into 'section'

@param aSection Section to work with
@return ETrue if successful or EFalse
*/
	{
    if (BlockState != E_UNKNOWN)
		{
	    blockStart = 0;
	    blockEnd = 0;
	    scanStart = 0;

	    TPtr sectionToken = iToken->Des();
		_LIT(sectionTokenString,"[%S]");
		sectionToken.Format(sectionTokenString,&aSection);

	    // locate the section
		TInt sectionStart = iPtr.FindF(sectionToken);
	    if (sectionStart == KErrNotFound)
			{
	        return EFalse;
			}

		// step to the end of the section name
		TPtrC tempSection = iPtr.Mid(sectionStart);
        sectionStart += tempSection.Find(TPtrC(_S("]")));

		if (sectionStart == KErrNotFound)
			{
			return EFalse;
			}
		sectionStart++;

		// we are now at the start of the section data
        tempSection.Set(iPtr.Mid(sectionStart));

		// loop until we reach the end of the section
		TUint32 i=0;
		TUint32 lMaxLen = tempSection.Length();

        for (i=0;i<lMaxLen;i++)
			{
	        if (tempSection.Ptr()[i] == '[' &&
		        tempSection.Ptr()[i - 1] != '\\')
				{
			    i--;
			    break;
				}
			}
		
		// set the actual section to work with
        tempSection.Set(iPtr.Mid(sectionStart, i));
		section.Set((unsigned short *)tempSection.Ptr(), tempSection.Length(), tempSection.Size());
		}

	return StepToNextBlock();	// find the first block
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:59,代码来源:CIniFile.cpp

示例3: BaseConstructL

// -----------------------------------------------------------------------------
// Cosmo4AppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void COsmo4AppUi::ConstructL()
{
    // Initialise app UI with standard value.
    BaseConstructL(CAknAppUi::EAknEnableSkin);

    /*Create display*/
    iAppView = COsmo4AppView::NewL( ClientRect() );
	AddToStackL(iAppView);

	/*create playlist*/
#ifndef GPAC_GUI_ONLY
	iPlaylist = CPlaylist::NewL( ClientRect(), iAppView->GetUser() );

	iPlaylist->MakeVisible(EFalse);
#endif
	
	iAppView->MakeVisible(ETrue);
	view_mode = 0;

	m_title = NULL;

	//StatusPane ()->SwitchLayoutL ( R_AVKON_STATUS_PANE_LAYOUT_SMALL );

	nb_keys = 0;
	CaptureKeys(1);



	CCommandLineArguments *args = CCommandLineArguments::NewL();
#ifndef GPAC_GUI_ONLY
	if (args->Count() > 1) {
		TPtrC url = args->Arg(1);
#if defined(_UNICODE)
		char szURL[1024];
		u16 szURLUTF16[1024];
		size_t len;
		len = url.Size();
		memcpy(szURLUTF16, url.Ptr(), sizeof(u8)*len);
		szURLUTF16[len/2] = 0;
		const u16 *sptr = szURLUTF16;
		len = gf_utf8_wcstombs(szURL, 512, &sptr);
		if (len != (size_t) -1) {
			szURL[len] = 0;
			iAppView->Connect((const char *)szURL);
		}
#else
		iAppView->Connect((const char *)url.Ptr());
#endif
	}
#endif
	delete args;
}
开发者ID:bigbensk,项目名称:gpac,代码行数:57,代码来源:osmo4_ui.cpp

示例4: GetResolverConfig

TInt CTS_MultiHomingStep::GetResolverConfig(const TInt aIndex, TName &aHostName, TInt& aProtocol,																				 
										TBool& aExpectSuccess, TBool& aExpectTimeout, TBool& aExpectNotReady, 
										TBool& aExplicitResolve, TConnDetails **aConnDetails)
/**
 * Gets resolver configuration from file, using defaults if necessary
 * @param aIndex The index for the socket configkey
 * @param aHostName The host to be resolved
 * @param aProtocol The protocol to be used
 * @param aExpectSuccess Flag indicating if name should be resolved ok
 * @param aExpectTimeout Flag indicating if name resolution should timeout
 * @param aConnDetails The connection for an explicit resolver
 * @return System wide error code
 */
	{
	TInt err=KErrNone;	
	TName resolverName;		// Create the Key for the config lookup
	resolverName = KResolver;
	resolverName.AppendNum(aIndex);
	
	TPtrC ptrBuf;
	err = GetStringFromConfig(resolverName, KDestName, ptrBuf);
	if (!err)
		{
		LogExtra((TText8*)__FILE__, __LINE__, ESevrWarn, KEConfigFile);
		iTestStepResult= EInconclusive;
		return KErrNotFound;
		}
	aHostName.Copy(ptrBuf.Ptr(), ptrBuf.Length());
		
	
	aExpectSuccess = ETrue;
	GetBoolFromConfig(resolverName, KExpectSuccess, aExpectSuccess);
	
	aExpectTimeout = EFalse;
	GetBoolFromConfig(resolverName, KExpectTimeout, aExpectTimeout);

	aExpectNotReady = EFalse;
    GetBoolFromConfig(resolverName, KExpectNoDnsServer, aExpectNotReady);

	aExplicitResolve = EFalse;
	GetBoolFromConfig(resolverName, KExplicitResolve, aExplicitResolve);
		

	err = GetStringFromConfig(resolverName, KProtocol, ptrBuf);
	if (err && (ptrBuf.Compare(KTcp)==0))
		aProtocol = KProtocolInetTcp;
	else
		aProtocol = KProtocolInetUdp;	
		
	
	err = GetStringFromConfig(resolverName, KConnName, ptrBuf);
	if (!err)
		{
		return KErrNotFound;
		}		

	*aConnDetails = iOwnerSuite->GetTConnection(ptrBuf);								

	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:60,代码来源:TS_MultiHomingStep.cpp

示例5: ClipLineOnLeft

EXPORT_C void AknPhoneNumberTextUtils::ClipLineOnLeft( 
    TPtrC& aLine, TDes& aOriginalBuffer, TInt aWidth, const CFont& aFont )
    {
    // Main work of this routine is to make a TPtr of the input TPtrC, then we can clip using existing
    // utils.
 
    // But first check if the line points to the provided modifiable buffer
    TText* linePtr = (TText*)aLine.Ptr();
    TInt lineLen = aLine.Length();
    TText* pastEndOfLine = linePtr + lineLen; // pointer arithmetic

    TText* modBufPtr = (TText*)aOriginalBuffer.Ptr();
    TInt len = aOriginalBuffer.Length(); // length actually with text in it (not maxlength)
    TText* pastEndOfModBufPtr = modBufPtr + len; // pointer arithmetic

    // This Panics if the input aLine is not encompassed within the modifiable buffer ->Programmer error
    __ASSERT_ALWAYS( (modBufPtr <= linePtr && pastEndOfLine <= pastEndOfModBufPtr ), Panic( EAknPanicInconsistentDescriptors ) );

    // Set the TPtr now to extend from the start of the original buffer to the end of the input aLine
    TInt enlargedLength = (pastEndOfLine - modBufPtr);//  Pointer arithmetic; 
    TPtr ptr( modBufPtr, enlargedLength, enlargedLength );

    // Should have a safe modifiable buffer now.
    AknTextUtils::ClipToFit( ptr, aFont, aWidth, AknTextUtils::EClipFromBeginning );
    aLine.Set( ptr );
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:26,代码来源:AknPhoneNumberTextUtils.cpp

示例6: openCamera

void TwtCamera::openCamera()
{
#ifdef Q_OS_SYMBIAN
    qDebug() << "TwtCamera::openCamera";
    CDesCArray* selectedFiles = new (ELeave) CDesCArrayFlat(1);
    CleanupStack::PushL(selectedFiles);

    CNewFileServiceClient* fileClient = NewFileServiceFactory::NewClientL();
    CleanupStack::PushL(fileClient);
    bool result = fileClient->NewFileL(KUidCamera, *selectedFiles, NULL,
                                       ENewFileServiceImage, EFalse);
    if(result)
    {
        TPtrC address = selectedFiles->MdcaPoint(0);
        QString filename = QString::fromUtf16(address.Ptr(), address.Length());
        qDebug() << "TwtCamera::openCamera name = " << filename;
        emit imgCaptured(filename);
    }
    else
    {
        qDebug() << "TwtCamera::openCamera file capture failed";
        emit imgCaptured("");
    }
    CleanupStack::PopAndDestroy( 2 ); // selectedFiles, fileClient
#else
    // for develop on simulator
    emit imgCaptured("");
#endif
}
开发者ID:jiecuoren,项目名称:Dragon-twitter,代码行数:29,代码来源:camera.cpp

示例7: ToggleCaseL

void CWordTest::ToggleCaseL(CEikRichTextEditor* aEditor)
{
    TCursorSelection sel = aEditor->Selection();
    int start = sel.LowerPos();
    int end = start;
    TBool to_upper = TRUE;
    while (end < sel.HigherPos())
    {
        TPtrC text;
        TCharFormat f;
        aEditor->RichText()->GetChars(text,f,start);
        int length = text.Length();
        if (start + length > sel.HigherPos())
            length = sel.HigherPos() - start;
        end = start + length;
        if (start == sel.LowerPos() && end > start)
        {
            if (TChar(text[0]).IsUpper())
                to_upper = FALSE;
        }
        TText* p = (TText*)text.Ptr();
        TText* q = p + length;
        while (p < q)
        {
            if (to_upper)
                *p = (TText)(TChar(*p).GetUpperCase());
            else
                *p = (TText)(TChar(*p).GetLowerCase());
            p++;
        }

        start = end;
    }
    aEditor->TextView()->HandleRangeFormatChangeL(sel);
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:35,代码来源:WPTEST.CPP

示例8: AddFieldInViewContactL

/**
Refine the field content and add the refined content to the given view contact object.
 
@param aViewContact     reference to the retrieved view contact object.
@param aFieldPtrC    	The actual field content read from database.
@param aViewPreferences The view preferences for how to format the content. 
*/
void CCntPplViewSession::AddFieldInViewContactL(CViewContact& aViewContact, TPtrC& aFieldPtrC, const TContactViewPreferences& aViewPreferences)
	{
	_LIT(KBlank," ");
	
	// Truncate to 64 if necessary.
	TPtr ptr(const_cast<TUint16*>(aFieldPtrC.Ptr()), KTextFieldMinimalLength);
	if(aFieldPtrC.Length() > KTextFieldMinimalLength) 
		{
		ptr.SetLength(KTextFieldMinimalLength); 
		}
	else
		{
		ptr.SetLength(aFieldPtrC.Length());
		}
		
	// Add the field to the view.
	if((ptr.Length() == 0) ||
	   (ptr.Length() == 1 && (aViewPreferences & ESingleWhiteSpaceIsEmptyField) && ptr.Compare(KBlank)==KErrNone))
		{
		/* empty field */
		aViewContact.AddFieldL(KNullDesC);
		} 
	else
		{
		aViewContact.AddFieldL(ptr);
		}
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:34,代码来源:cntpplviewsession.cpp

示例9: syncProfiles

void ProfileListModel::syncProfiles()
{
    beginResetModel();

    mNameList.clear();
    mIdList.clear();

#ifdef Q_OS_SYMBIAN
    MProEngEngine* engine(0);
    TRAPD(err, engine = ProEngFactory::NewEngineL());
    if(err == KErrNone)
    {
        TRAP_IGNORE(
            MProEngProfileNameArray* array(engine->ProfileNameArrayLC());
            for(TInt i(0); i < array->MdcaCount(); ++i)
            {
                const TPtrC name(array->MdcaPoint(i));
                const TInt id(array->ProfileId(i));

                mNameList.append(QString::fromUtf16(name.Ptr(), name.Length()));
                mIdList.append(id);
            }

            CleanupStack::PopAndDestroy(array);
        );
开发者ID:pastillilabs,项目名称:situations-symbian,代码行数:25,代码来源:profilelistmodel.cpp

示例10: supportedSerialFormats

jobjectArray CPIMSerializer::supportedSerialFormats(TPIMListType aPimListType,
        JNIEnv* aJniEnv, jintArray aError)
{
    JELOG2(EPim);
    const CDesCArray* desArray = NULL;
    TInt error = KErrNone;
    TRAP(error, desArray = &(SupportedSerialFormatsL(aPimListType)));
    if (error != KErrNone)
    {
        SetJavaErrorCode(aJniEnv, aError, error);
        return NULL;
    }

    if (!desArray)
    {
        SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
        return NULL;
    }

    TInt desCount = desArray->Count();
    jobjectArray retVal = aJniEnv->NewObjectArray(desCount, aJniEnv->FindClass(
                              "java/lang/String"), NULL);
    if (retVal == NULL)
    {
        SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
        return NULL;
    }

    for (TInt i = 0; i < desCount; i++)
    {
        TPtrC epocString = (*desArray)[i];
        jstring javaString = aJniEnv->NewString(epocString.Ptr(),
                                                epocString.Length());
        if (javaString == NULL)
        {
            SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
            return NULL;
        }
        aJniEnv->SetObjectArrayElement(retVal, i, javaString);

        // Avoid exceeding max local references (5)
        aJniEnv->DeleteLocalRef(javaString);
    }
    // note that desArray is owned by the adapter, and not deleted here
    SetJavaErrorCode(aJniEnv, aError, KErrNone);
    return retVal;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:47,代码来源:cpimserializer.cpp

示例11: StepToNextBlock

TInt CIniData::StepToNextBlock()
/**
Locates the next available block of data within a section

@return ETrue if successful or EFalse
*/
	{
	if (BlockState != E_UNKNOWN)
		{
		// get unscanned portion of the section
		TPtrC temp = section.Mid(scanStart);

		// find the start of the next block
		if (BlockState == E_SET)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_SET));
			blockEnd = temp.FindF(TPtrC(END_SET));
			}
		else if (BlockState == E_TEMPLATE)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_TEMPLATE));
			blockEnd = temp.FindF(TPtrC(END_TEMPLATE));
			}
		else if (BlockState == E_ADD)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_ADD));
			blockEnd = temp.FindF(TPtrC(END_ADD));
			}

		if (blockStart != KErrNotFound && blockEnd != KErrNotFound)
			{
			// set the start point for the next block search
			scanStart += blockEnd;
			scanStart++;

			// set the actual block to work with
			blockEnd -= blockStart;
			TPtrC tempBlock = temp.Mid(blockStart,blockEnd);
			block.Set((unsigned short *)tempBlock.Ptr(), tempBlock.Length(), tempBlock.Size());
			return ETrue;
			}
		}

	return EFalse;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:45,代码来源:CIniFile.cpp

示例12: GotSMSMessageL

void NotifyProvider::GotSMSMessageL(QString txt, const TPtrC aSender,TInt32 id)
{
    // new sms
    QString number=QString::fromRawData(reinterpret_cast<const QChar*>(aSender.Ptr()),aSender.Length());
    //QString txt=QString::fromRawData(reinterpret_cast<const QChar*>(aMessage.Ptr()),aMessage.Length());;
    QDateTime dt=QDateTime::currentDateTime();
    dt=dt.toLocalTime();
    TNotifyInfo info;
    info.time=dt.toString("dd.M.yy hh:ss");
    info.timeStamp=dt;
    info.sender=findContact(number);
    info.text=txt;
    info.type=ESMS;
    info.id=id;
    iNotifiers.insert(0,info);
    qDebug()<<"store sms from"<<info.sender<<info.text;
    qDebug()<<"id"<<id;
    prepareNotifier(ESMS);
}
开发者ID:KingSD502,项目名称:dUnlock,代码行数:19,代码来源:notifyprovider.cpp

示例13: ParagraphEnd

/**
Return the end of the paragraph - after the paragraph separator if any.
*/
EXPORT_C TInt MTmSource::ParagraphEnd(TInt aPos) const
	{
	TInt doc_end = DocumentLength();
	TPtrC text;
	TTmCharFormat format;
	while (aPos < doc_end)
		{
		GetText(aPos,text,format);
		const TText *p = text.Ptr();
		const TText *q = p + text.Length();
		while (p < q)
			if (*p == CEditableText::EParagraphDelimiter)
				return aPos + 1;
			else
				{
				p++;
				aPos++;
				}
		}
	return doc_end + 1;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:24,代码来源:TMSOURCE.CPP

示例14: ColumnText

/**
Copies the content of a text column, identified by aColumnIndex, to the place refered by aDest parameter.

If the destination buffer is not big enough, the function will copy as much data as possible and will
return KErrOverflow.

@param aColumnIndex Column index
@param aDest Refers to the place where the column data will be copied.

@return KErrNone, if the function completes successfully,
                  otherwise one of the other system-wide error codes.

@panic SqlDb 5 Column index out of bounds.
@panic SqlDb 11 Statement cursor not positioned on a row
*/	
TInt CSqlStatementImpl::ColumnText(TInt aColumnIndex, TDes& aDest)
	{
	__ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex));
	__ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow));
	iColumnValBufIt.MoveTo(aColumnIndex);		
	TInt err = KErrNone;
	//The text column value has not been transferred to the client side if its length is >= KSqlMaxDesLen characters.
	//In this case an additional call to the server is made to get the column value.
	if(!iColumnValBufIt.IsPresent())
		{
		if(iColumnValBufIt.Type() != ESqlText)
			{
			aDest.Zero();
			return err;
			}
		TPtr8 ptr(reinterpret_cast <TUint8*> (const_cast <TUint16*> (aDest.Ptr())), aDest.MaxLength() * sizeof(TUint16));
		err = iSqlStmtSession.ReadColumnValue(aColumnIndex, ptr);
		switch(err)
		    {
	        case KErrNone:
	        case KErrOverflow:
	            aDest.SetLength(ptr.Length() / sizeof(TUint16));
	            break;
	        default:
	            break;
		    }
		}
	else
		{
		TPtrC src = iColumnValBufIt.Text();
		TInt len = src.Length();
		if(len > aDest.MaxLength())
			{
			len = aDest.MaxLength();
			err = KErrOverflow;
			}
		aDest.Copy(src.Ptr(), len);
		}
	return err;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:SqlStatementImpl.cpp

示例15: StartPSYCRTesterL

void StartPSYCRTesterL() 
	{

	// Read the Process Arguments
	TInt psyIDValue;

    // PSY Tester sends the UID of the PSY as an argument
	CCommandLineArguments *args = CCommandLineArguments::NewL();
	CleanupStack::PushL(args);
	if(args->Count() <= 1)
	{
			User::Leave(KErrArgument);
	}
	TPtrC ptr = args->Arg(1);
	
	TLex lex(ptr.Ptr());
	TInt err = lex.Val(psyIDValue);

	if(KErrNone == err)
	{
		
		CPosPSYCRTestHandler* psyCRTestHandler = CPosPSYCRTestHandler::NewL();
		CleanupStack::PushL(psyCRTestHandler);

		TUid psyID;
		psyID.iUid = psyIDValue;
	
	    // Start the test	
		psyCRTestHandler->StartPSYCRTesterL(psyID);
		
		CleanupStack::PopAndDestroy(psyCRTestHandler);
	}
	
	CleanupStack::PopAndDestroy(args);
		
	RProcess::Rendezvous(KErrNone);

	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:38,代码来源:epos_psycrtester_main.cpp


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