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


C++ TPtrC类代码示例

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


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

示例1: OverrideFormatForParsersIfApplicable

void CRichText::OverrideFormatForParsersIfApplicable(TPtrC& aText, TCharFormatX& aFormat, TInt aStartPos) const
	{
	if (aFormat.iParserTag && iParserData->iActiveParserList && iParserData->iEditObserver)
		{
		// Replace format
		TInt start = -1;
		TInt length = 0;
		TInt curPos = iParserData->iLastKnownCursor;
		if (curPos > DocumentLength())
			curPos = DocumentLength();  // This shouldn't be neccesary but it makes it more
										// bulletproof if the calls from outside are made in
										// the wrong order
		if (curPos != -1)
			{
			TCharFormatX format;
			TCharFormatXMask varies;
			MParser* parser;

			GetExtendedCharFormat(format, varies, curPos, 1);
			// If char at curpos has a tag then cursor is over that tag, get extents of tag
			if (CParserList::ReformatOnRollover(format.iParserTag))
				DoCursorOverTag(curPos, parser, start, length);
			else if (curPos)
				{
				GetExtendedCharFormat(format, varies, curPos - 1, 1);
				// Try the char "before" curpos
				if (CParserList::ReformatOnRollover(format.iParserTag))
					DoCursorOverTag(curPos - 1, parser, start, length);
				}
			}

		MParser* parser = iParserData->iActiveParserList->ParserWithThisTag(aFormat.iParserTag);
		
		if (length && (aStartPos >= start) && (aStartPos < start + length))
			{
			if (start + length < aStartPos + aText.Length())
				aText.Set(aText.Left(start + length - aStartPos));
			if (parser != NULL)
				{
				// Only accept the rollover format if the parser agrees 
				// with the framework match of a tag
				if (parser->ConfirmCursorOverTag(*this, start, length, curPos))
					parser->GetRolloverFormat(aFormat.iCharFormat);
				else 
					// Reset format to recognised format if parser disagrees
					// with the framework match as the tag is still in view
					// and must be formatted as in the else clause below.
					parser->GetRecogniseFormat(aFormat.iCharFormat);
				}
			}
		else
			{
			if (length && (start > aStartPos))
				aText.Set(aText.Left(start - aStartPos));
			if (parser != NULL)
				parser->GetRecogniseFormat(aFormat.iCharFormat);
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:59,代码来源:Txtparse.cpp

示例2: SetSharedTextL

/**
used by concurrent tests to write shared text to aShare either appedning or overwriteing
*/
void CPerformanceFunctionalityBase::SetSharedTextL(const TDesC &aShare, const TDesC &aText, const TBool aAppend)
	{

	TPtrC txtWriteData;
	txtWriteData.Set(aText); // Copy the literal to a text buffer
	WriteSharedDataL(aShare, txtWriteData, (aAppend ? EAppendText : ESetText) ); // Data copied to shared location

	}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:11,代码来源:performancefunctionalitybase.cpp

示例3: PlayFile

TInt CSoundManager::PlayFile()
{
    TPtrC file = iData->GetSelectFile();
    if (file.Compare(KNullDesC)== 0)
        return KErrNotFound;
    else
        return LoadFile(file);
}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:8,代码来源:SoundManager.cpp

示例4: DoListStoresLCL

void CNSmlDummyDataProvider_Test::DoListStoresLCL()
    {
    CDesCArray* store = iCNSmlDummyDataProvider->DoListStoresLC();
    TPtrC ptrStoreName = ( *store )[ 0 ];
    EUNIT_PRINT( ptrStoreName );
    EUNIT_ASSERT( ptrStoreName.Compare( KDefaultDBName ) == 0 );
    CleanupStack::PopAndDestroy( store );
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:8,代码来源:cnsmldummydataprovider_test.cpp

示例5: Name

TPtrC CSystemStartupStateInfo::Name() const
	{
	TPtrC retval;
	if (iName)
		{
		retval.Set(*iName);
		}
	return retval;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:9,代码来源:SystemStartupStateInfo.cpp

示例6: addressesAdded

// ----------------------------------------------------
// CUniAddressHandler::AddRecipientL
//
// Performs address(es) fetch operation.
// ----------------------------------------------------
//
EXPORT_C TBool CUniAddressHandler::AddRecipientL( TBool& aInvalid )
    {
    TBool addressesAdded( EFalse );
    aInvalid = EFalse;
    
    CMsgRecipientList* recipientList = CMsgRecipientList::NewL();
    CleanupStack::PushL( recipientList );

    CMsgRecipientArray* recipients = new ( ELeave ) CMsgRecipientArray( 10 );
    CleanupStack::PushL( TCleanupItem( CleanupRecipientArray, recipients ) );
    
    // Multiple entry fetch to get the contact    
    if ( !iCheckNames )
        {
        iCheckNames = CMsgCheckNames::NewL();
        }
        
    iCheckNames->FetchRecipientsL( *recipients, iValidAddressType );
    
    // Contacts now fetched, verify that valid address is given for every contact
    while ( recipients->Count() > 0 )
        {
        CMsgRecipientItem* recipient = recipients->At( 0 );
        
        TPtrC namePtr = recipient->Name()->Des();
        TPtrC addressPtr = recipient->Address()->Des();

        // Don't parse away chars here so this is consistent with 
        // addresses that user writes "-()" are saved to draft
        // but removed when sending
        if ( CheckSingleAddressL( addressPtr ) )
            {
            //  add it to the list of valid addresses
            recipient->SetValidated( ETrue );
            recipient->SetVerified( ( namePtr.Length() > 0 ? ETrue : EFalse ) );
            recipientList->AppendL( recipient );
            }
        else
            {
            aInvalid = ETrue;
            ShowAddressInfoNoteL( addressPtr, namePtr );
            delete recipient;
            }
        
        recipients->Delete( 0 );
        }
    
    if ( recipientList->Count() > 0 )
        {
        iControl.AddRecipientsL( *recipientList );
        addressesAdded = ETrue;
        }
 
    CleanupStack::PopAndDestroy( 2, recipientList );//recipients
    
    return addressesAdded;
    }
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:63,代码来源:uniaddresshandler.cpp

示例7: DialogWithAnimationL

void CSimpleAppUi::DialogWithAnimationL(TInt aResourceId)
	{
    TPtrC ptr;
	ptr.Set(KTBmpAnimMBMFilePath/*Application()->BitmapStoreName()*/);
	
	
	CEikDialog* dialog = new (ELeave) CAnimationDlg(ptr);
	dialog->ExecuteLD(aResourceId);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:9,代码来源:TBMPAnimStep.cpp

示例8: _LIT

/*
	Tests whether Publishing a Service/Device is performing as specified in UPnP specifications.
	@param			aOperationType is reference to a section name in ini file where required parameters
					needs to be referred for this operation.
	@return			None.
 */
void CTestRControlChannel::PublishServiceL (const TDesC& aOperationType)
	{
	_LIT(KInfoLogFile, "CTestRControlChannel::PublishServiceL ().... \n");
	INFO_PRINTF1(KInfoLogFile);
	CRControlChannelObserver* upnpObserver = CRControlChannelObserver::NewL(this);
	CleanupStack::PushL( upnpObserver );
	iObserverArray.Append(upnpObserver);

	RPnPParameterBundle pnpBundle ;
	pnpBundle.Open();
    CleanupClosePushL( pnpBundle );
    pnpBundle.SetPnPObserver((MPnPObserver*)upnpObserver);
    RParameterFamily family = pnpBundle.CreateFamilyL(EUPnPServiceRegisterParamSet);
   	CUPnPServiceRegisterParamSet* registerServiceParamSet = CUPnPServiceRegisterParamSet::NewL(family );

   	_LIT(KParentDeviceUid, "ParentDeviceUid");
   	TPtrC parentDeviceUid;
	GetStringFromConfig(aOperationType, KParentDeviceUid, parentDeviceUid);

	RBuf8 parentDeviceUidBuf;
	parentDeviceUidBuf.Create(parentDeviceUid.Length());
	parentDeviceUidBuf.Copy(parentDeviceUid);
	registerServiceParamSet->SetDeviceUidL (parentDeviceUidBuf);


	TPtrC serviceType;
	GetStringFromConfig(aOperationType, KServiceType, serviceType);
	RBuf8 serviceTypeBuf;
	serviceTypeBuf.Create(serviceType.Length());
	serviceTypeBuf.Copy(serviceType);
	registerServiceParamSet->SetUriL ( serviceTypeBuf );


	TInt duration;
	GetIntFromConfig(aOperationType, KCacheControl, duration);
	registerServiceParamSet->SetCacheControlData (duration);

	ExtractServiceDescriptionL (aOperationType, *registerServiceParamSet);

	_LIT8(KInitialMessage, "Initial notification message");
	registerServiceParamSet->SetInitialMessageL(KInitialMessage);
	
	OpenPublisherL();

	iPublisher.Publish( pnpBundle );
	CActiveScheduler::Start();

	serviceTypeBuf.Close();
	parentDeviceUidBuf.Close();
	CleanupStack::PopAndDestroy( &pnpBundle );
	CleanupStack::Pop( upnpObserver );
	
	InitiateControlL();
	_LIT(KInfoLogFile1, "CTestRControlChannel::PublishServiceL () Stop.... \n");
	INFO_PRINTF1(KInfoLogFile1);
	
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:63,代码来源:testrcontrolchannel.cpp

示例9: GetChars

 void GetChars(TPtrC& aView,TCharFormat& aFormat, TInt aStartPos)const
 {
     TCharFormat cf;
     aFormat = cf;
     if (aStartPos == LdDocumentLength())
         aView.Set(KEnd);
     else
         aView.Set(iDes->Mid(aStartPos));
 }
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:9,代码来源:TCustomCharMapping.cpp

示例10: Machine

TInt CCmdShowTransaction::ProcessL(const TDesC& aCommand)
	{
	// Complete the test machine - will then get the next cmd
	Machine()->CompleteRequest();
	
	TPtrC param;
	TInt error = KErrNone;
	TRAP(error, param.Set( ParamsL(aCommand)));
	if (error != KErrNone)
		return Error(error, TFR_KFmtErrBadCmd, &Keyphrase());
	
	CObjCatalogue *trnsctns = Machine()->Domains();
	TInt iTrans = 0;

	Log(_L("\tCurrent Transactions:"));
	Log(_L("\tName  \tMethod  \tURI"));
	for (TInt i = 0; i < trnsctns->Count(); ++i)
		{
		CAnyObject *obj = (CAnyObject *)trnsctns->At(i);
		if (obj->Tag() == THA_KHTTP_Transaction)
			{
			TPtrC label = obj->Name();
			TInt eStrIndex = obj->Index();
			CTestTransaction *trans = (CTestTransaction *)obj->Ptr();
			TBuf<256> uri;
			uri.Copy (trans->Uri()) ;
									
			TPtrC mthd;
						
			switch (eStrIndex)
				{
				case HTTP::EGET : mthd.Set(THA_TxtCmdTransactionGET); break;
				case HTTP::EPOST : mthd.Set(THA_TxtCmdTransactionPOST); break;
				case HTTP::EPUT : mthd.Set(THA_TxtCmdTransactionPUT); break;
				case HTTP::EDELETE : mthd.Set(THA_TxtCmdTransactionDELETE); break;
				case HTTP::EHEAD : mthd.Set(THA_TxtCmdTransactionHEAD); break;
				case HTTP::EOPTIONS : mthd.Set(THA_TxtCmdTransactionOPTIONS); break;
				case HTTP::ETRACE : mthd.Set(THA_TxtCmdTransactionTRACE); break;
				default : break;
				}
			++iTrans;
//			if (trans->iState == CTestTransaction::EActive)
			if (trans->State() == CTestTransaction::EActive)
				{
				Log(_L("\t%d\t%S\t%S\t%S"), iTrans, 
					&label, 
					&mthd,
					&uri);
				}
			}
		}
	if (iTrans == 0)
		Log(_L("\tNo transactions have been defined"));
		
	return KErrNone;
	
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:57,代码来源:HttpTransactionCmds.cpp

示例11: _LIT

void CMemSpyEngineActiveObject::ConstructL( CMemSpyEngine& /*aEngine*/ )
    {
    TBuf<256> item;

    _LIT(KBasicFormat, "\t0x%08x\t\t");
    item.Format( KBasicFormat, VTable() );

    // Add modifiers
    _LIT( KModifiers, "%d" );
    _LIT( KBoxedCharFormat, " [%c]" );
    item.AppendFormat( KModifiers, RequestStatusValue() );
    if  ( IsActive() )
        {
        item.AppendFormat( KBoxedCharFormat, 'A' );
        }
    if  ( RequestIsPending() )
        {
        item.AppendFormat( KBoxedCharFormat, 'P' );
        }
    iCaption = item.AllocL();

    // Listbox items
    TPtrC value;

    // Address
    _LIT(KCaption1, "\tAddress\t\t0x%08x");
    item.Format( KCaption1, iAddress );
    AppendL( item );

    // vTable
    _LIT(KCaption2, "\tVTable\t\t0x%08x");
    item.Format( KCaption2, iVTable );
    AppendL( item );

    //
    _LIT(KCaption3, "\tStatus Value\t\t%d");
    item.Format( KCaption3, iRequestStatusValue );
    AppendL( item );

    //
    _LIT(KCaption5, "\tIs Active\t\t%S");
    value.Set( YesNoValue( IsActive() ) );
    item.Format( KCaption5, &value );
    AppendL( item );

    //
    _LIT(KCaption6, "\tRequest Pending\t\t%S");
    value.Set( YesNoValue( RequestIsPending() ) );
    item.Format( KCaption6, &value );
    AppendL( item );

    //
    _LIT(KCaption4, "\tPriority\t\t%d");
    item.Format( KCaption4, iPriority );
    AppendL( item );
    }
开发者ID:RomanSaveljev,项目名称:osrndtools,代码行数:56,代码来源:MemSpyEngineHelperActiveObject.cpp

示例12: new

void CHttpTypes::ReadHttpTypesFileL(const TDesC& aFileName)
{
	RFs fs;

#if EPOC_SDK >= 0x06000000
	User::LeaveIfError(fs.Connect());
	iHttpTypesArray = new (ELeave) CDesCArrayFlat(HTTP_TYPES_ARRAY_GRANURALITY);

	HBufC *config = NULL;
	// Need to TRAP leaves, because must close the fs (right).
	// Thus, no point in using the CleanupStack for config either.
	//
	TRAPD(err, config = UnicodeLoad::LoadL(fs, aFileName));
	if (err == KErrNone && config != NULL)
		{
		TLineBuffer buffer(config->Des());
		while (!buffer.EOB())
			{
			TPtrC line = buffer.ReadLine();
			if (line.Length() > 0)
				{
				TRAP(err, ParseTypeLineL(line));
				if (err != KErrNone)
					break;
				}
			}
		}
	delete config;
	User::LeaveIfError(err);

#else
	RFile cfg;
	TFileText cfgtxt;
	TBuf<256> buffer;

	User::LeaveIfError(fs.Connect());
	User::LeaveIfError(cfg.Open(fs,aFileName,EFileStreamText));

	iHttpTypesArray = new (ELeave) CDesCArrayFlat(HTTP_TYPES_ARRAY_GRANURALITY);
	
	cfgtxt.Set(cfg);
	User::LeaveIfError(cfgtxt.Seek(ESeekStart));
	
	cfgtxt.Read(buffer);
	while (buffer.Length() > 0)
	{
		ParseTypeLineL(buffer);
		cfgtxt.Read(buffer);
	}
	
	cfg.Close();
#endif
	iHttpTypesArray->Sort();

	fs.Close();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:56,代码来源:ws_eng.cpp

示例13: testTPtrLocateReverse

LOCAL_C void testTPtrLocateReverse()
//
// Test locating in reverse on an empty TPtr
//
	{

	TPtrC a;
	test(a.LocateReverse('0')==KErrNotFound);
	test(a.LocateReverseF('0')==KErrNotFound);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:10,代码来源:t_des.cpp

示例14: LeaveIfFileParamsNotValidL

//Add aItem to DSC at aPos
void CDscDatabase::AddItemL(CDscItem& aItem, TDscPosition aPos)
	{
	//Leave if DB is opened for enumeration
	if (iIsEnumOpened)
		{
		User::Leave(KErrLocked);
		}
	
	//verify data integrity,
	LeaveIfFileParamsNotValidL(aItem);
	if(aItem.ItemId() != 0)
		{
		User::Leave(KErrArgument);
		}

	//Start transaction
	DatabaseBeginLC();

	//Leave if aDscId doesn't exist
	if (!DscExistsL(aItem.DscId()))
		{
		User::Leave(KErrNotFound);
		}

	//Leave if aItem exists
	if (ItemExistsL(aItem))
		{
		User::Leave(KErrAlreadyExists);
		}

	const TPtrC filename = aItem.FileName();
	const TPtrC argList = aItem.Args();	//whitespace already trimmed
	const TInt itemId = GetNextItemIdL(aPos, aItem.DscId());
	
	RBuf sqlCmd;
	CleanupClosePushL(sqlCmd);
	sqlCmd.CreateL(KSqlInsertDscItemLength + filename.Length() + argList.Length());
	
	//insert the item
	sqlCmd.Format(KSqlInsertDscItem, &KItemTable, &KDscIdCol, &KItemIdCol, &KFileNameCol, &KArgListCol,
				&KStartMethodCol, &KTimeoutCol, &KNoOfRetriesCol, &KMonitorCol, &KStartupTypeCol,
				&KViewlessCol, &KStartInBackgroundCol, aItem.DscId(), itemId, &filename, &argList, aItem.StartMethod(),
				aItem.Timeout(), aItem.NoOfRetries(), aItem.Monitored(),
				aItem.StartupType(), aItem.Viewless(), aItem.StartInBackground());

	DebugPrint(sqlCmd);
	
	User::LeaveIfError(iDatabase.Execute(sqlCmd));
	CleanupStack::PopAndDestroy(&sqlCmd);
	DatabaseCommitL(); //CommitL + CleanupStack::Pop()
	
	//Now aItem is persistent, set the ItemId so it can be read by the client
	aItem.SetItemId(itemId);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:55,代码来源:dscdatabase.cpp

示例15: SetStepOver

TBool CCmdRemark::Recognize( const TDesC& aCommand  )
{
// Obey the command family's step over mode.
SetStepOver(Family()->StepOver());

// Check if is empty or begins with # character.
TPtrC cmd = TfrLex::Trim(aCommand);

//	look for empty, # or //
return ((cmd.Length() == 0) || (cmd.Match( _L("#*")) == 0) || (cmd.Match(_L("//*")) == 0 ));
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:11,代码来源:CCmdStandard.cpp


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