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


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

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


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

示例1: ProcessL

TInt CCmdSetPrompt::ProcessL( const TDesC& aCommand )
{
// Complete the test machine - will then get the next cmd
Machine()->CompleteRequest();

TPtrC param;
TRAPD( error, param.Set( ParamsL( aCommand )) );
if ( error != KErrNone )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

TLex parse( param );
if ( !parse.Eos() && !parse.Peek().IsSpace() )
	return Error( error, TFR_KFmtErrBadCmd, &Keyphrase() );

// ParseOnly => not executed.
if ( Family()->Switch(CCmdFamily::EParseOnly) )
	return error;

// Alter prompt, back to the default one if no new one.
param.Set( TfrLex::TrimAndPeel( param ) );
if ( param.Length() == 0 ) 
	param.Set(THA_CommandPrompt);

if ( error = Machine()->SetPrompt( param ), error != KErrNone )
	// ### Failure
	Log( TFR_KFmtErrFailed, &Keyphrase(), error );

return error;
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:29,代码来源:CCmdStandard.cpp

示例2: EncodeContentTypeLC

CASN1EncObjectIdentifier* CmsUtils::EncodeContentTypeLC(TInt aContentType)
	{
	TPtrC oidBuf;
	switch (aContentType)
		{
	case EContentTypeData:
		oidBuf.Set(KCmsDataOID());
		break;
		
	case EContentTypeSignedData:
		oidBuf.Set(KCmsSignedDataOID());
		break;
		
	case EContentTypeEnvelopedData:
		oidBuf.Set(KCmsEnvelopedDataOID());
		break;
	
	case EContentTypeDigestedData:
		oidBuf.Set(KCmsDigestedDataOID());
		break;
	
	case EContentTypeEncryptedData:
		oidBuf.Set(KCmsEncryptedDataOID());
		break;
	
	default:
		User::Leave(KErrArgument);
		}
	//Encode the OID		
	CASN1EncObjectIdentifier* oid=CASN1EncObjectIdentifier::NewLC(oidBuf);
	return oid;	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:32,代码来源:cmsutils.cpp

示例3: text

/**
Return a text (16 bit) descriptor to a text column identified by aColumnIndex.

@param aColumnIndex Column index
@param aPtr An output parameter which will be set to point to the column data.

@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, TPtrC& aPtr)
	{
	__ASSERT_ALWAYS((TUint)aColumnIndex < (TUint)iColumnCnt, __SQLPANIC(ESqlPanicBadColumnIndex));
	__ASSERT_ALWAYS(iState == CSqlStatementImpl::EAtRow, __SQLPANIC(ESqlPanicInvalidRow));
	iColumnValBufIt.MoveTo(aColumnIndex);		
	if(iColumnValBufIt.IsPresent())
		{
		aPtr.Set(iColumnValBufIt.Text());
		return 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.
	//The column value is stored in a separate collection (iLongColumnColl), because if iColumnValueBuf gets reallocated,
	//the client can get a dangling pointer to some of the located in iColumnValueBuf text/binary column values.
	if(iColumnValBufIt.Type() != ESqlText)
		{
		aPtr.Set(KNullDesC);
		return KErrNone;
		}
	if(!iLongColumnColl.IsPresent(aColumnIndex))
		{
		TSqlLongColumnReader colReader(iSqlStmtSession);
		TInt err = iLongColumnColl.Append(colReader, aColumnIndex, iColumnValBufIt.Size() * sizeof(TUint16));
		if(err != KErrNone)
			{
			return err;	
			}
		}
	aPtr.Set(iLongColumnColl.Text(aColumnIndex));
	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:43,代码来源:SqlStatementImpl.cpp

示例4: TableNameForCategoryL

// ----------------------------------------------------------------------------
// MPXDbUtil::TableNameForCategoryL
// ----------------------------------------------------------------------------
//
TPtrC MPXDbUtil::TableNameForCategoryL(
    TMPXGeneralCategory aCategory)
    {
    MPX_FUNC("MPXDbUtil::TableNameForCategoryL");

    TPtrC ptr;
    switch (aCategory)
        {
        case EMPXArtist:
            ptr.Set(KMCAuthorTable);
            break;
        case EMPXAlbum:
            ptr.Set(KMCTitleTable);
            break;
        case EMPXGenre:
            ptr.Set(KMCCategoryTable);
            break;
        case EMPXComposer:
            ptr.Set(KMCComposerTable);
            break;
        default:
            User::Leave(KErrNotSupported);
        }

    return ptr;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:30,代码来源:mpxdbutil.cpp

示例5: PodcastFieldNameForCategoryL

// ----------------------------------------------------------------------------
// MPXDbUtil::PodcastFieldNameForCategoryL
// ----------------------------------------------------------------------------
//
TPtrC MPXDbUtil::PodcastFieldNameForCategoryL(
    TMPXGeneralCategory aCategory)
    {
    MPX_FUNC("MPXDbUtil::PodcastFieldNameForCategoryL");

    TPtrC ptr;
    switch (aCategory)
        {
        case EMPXArtist:
            ptr.Set(KMCPodcastAuthor);
            break;

        case EMPXAlbum:
            ptr.Set(KMCPodcastTitle);
            break;

        case EMPXGenre:
            ptr.Set(KMCPodcastGenre);
            break;

        case EMPXComposer:
            ptr.Set(KMCPodcastComposer);
            break;

        default:
            User::Leave(KErrNotSupported);
        }

    return ptr;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:34,代码来源:mpxdbutil.cpp

示例6: init

    void init()
    {
        _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll");
        _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll");

        TPtrC libName;
        TInt uidValue;
        switch (QSysInfo::s60Version()) {
        case QSysInfo::SV_S60_3_1:
            libName.Set(KLibName_3_1);
            uidValue = 0x2001E620;
            break;
        case QSysInfo::SV_S60_3_2:
            libName.Set(KLibName_3_2);
            uidValue = 0x2001E621;
            break;
        case QSysInfo::SV_S60_5_0: // Fall through to default
        default:
            // Default to 5.0 version, as any unknown platform is likely to be newer than that
            libName.Set(KLibName_5_0);
            uidValue = 0x2001E622;
            break;
        }

        TUidType libUid(KDynamicLibraryUid, KSharedLibraryUid, TUid::Uid(uidValue));
        lib.Load(libName, libUid);

        // Duplicate lib handle to enable process wide access to it. Since Duplicate overwrites
        // existing handle without closing it, store original for subsequent closing.
        RLibrary origHandleCloser = lib;
        lib.Duplicate(RThread(), EOwnerProcess);
        origHandleCloser.Close();
    }
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:34,代码来源:qcore_symbian_p.cpp

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

示例8: GetRPSNumber

// Set aNumber to the relevant phone number based on the line type (either data, fax or voice line)
// If Using RPS then the number will be retrieved from RPS, otherwise it will read the number from the 
// ctsyintegration_data.ini file.
void CCTSYIntegrationTestSuiteStepBase::GetRPSNumber(TEtelLine aLine, TPtrC& aNumber) 
	{

	if (UsingRps())
		{
		 switch(aLine)
			{
			case EDataLine:
				aNumber.Set(iRPS->RpsSlaveTelNumData());
				break;
			case EFaxLine:
				aNumber.Set(iRPS->RpsSlaveTelNumFax());
				break;
			case EVoiceLine:
				default:
				aNumber.Set(iRPS->RpsSlaveTelNum());
			}		
		}
	else
		{
		 switch(aLine)
			{
			case EDataLine:
				GetStringFromConfig(KIniOwnNumSection,KIniOwnDataNumber,aNumber);
				break;
			case EFaxLine:
				GetStringFromConfig(KIniOwnNumSection,KIniOwnFaxNumber,aNumber);
				break;
			case EVoiceLine:
				default:
				GetStringFromConfig(KIniOwnNumSection, KIniOwnVoiceNumber1, aNumber);
			}		
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:37,代码来源:cctsyintegrationtestsuitebase.cpp

示例9: GetIniFileInfo

EXPORT_C TInt TEFparser::GetIniFileInfo(TDesC& aBuf, 
											  TPtrC& aIniFileName, 
											  TPtrC& aIniSectionName)
	{
	TInt pos =0;
	TInt startPos = 0, endPos = 0;
	
	
	TPtrC temp = aBuf.Mid(pos);
	
	endPos = temp.Find(KIniExtension);
	endPos += 4;
	
	if (endPos != KErrNotFound)
		{
		TInt len = endPos - startPos;
		TPtrC iniFileName = temp.Mid(startPos, len);
		aIniFileName.Set(iniFileName);
		
		TPtrC iniSectionName = temp.Mid(iniFileName.Length());
		aIniSectionName.Set(Trim(iniSectionName));
		
		return KErrNone;
		}
	else
		{
		return KErrNotFound;
		}
	
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:30,代码来源:TEFparser.cpp

示例10: PrintSystemServerSecurity

void PrintSystemServerSecurity(CPrinter* aPrinter, CPolicy *aPolicy)
/**
Prints the system server security configuration.
*/
	{

	TPtrC p;
	switch (aPolicy->SystemServerSecurity())
		{
	case CPolicy::ESystemServerSecurityPassedOrFailed:
		p.Set(_L("ESystemServerSecurityPassedOrFailed"));
		break;
	case CPolicy::ESystemServerSecurityPassed:
		p.Set(_L("ESystemServerSecurityPassed"));	
		break;
	case CPolicy::ESystemServerSecurityFailed:
		p.Set(_L("ESystemServerSecurityFailed"));
		break;
	default:
		p.Set(_L("*** UNKNOWN ***"));
		break;				
		}
	TBuf<80> buf;
	buf.AppendFormat(_L(" System Server Security: %S\n"), &p);
	aPrinter->PrintL(buf);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:26,代码来源:dumppolicy.cpp

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

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

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

示例14: ConstructL

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

示例15: Peel

TPtrC TfrLex::Peel( const TDesC& aText )
{
TPtrC result;
TInt  length = aText.Length();
if ( length >= 2 && (aText[0] == '"' && aText[length-1] == '"') )
	result.Set( aText.Mid(1,length-2) );
else
	result.Set( aText );

return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:11,代码来源:TfrLex.cpp


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