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


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

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


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

示例1: BuildUnknownL

/**
Test MSdpElementBuilder::BuildUnknownL()
*/
void CT_DataSdpElementBuilder::DoCmdBuildUnknownL(MSdpElementBuilder& aElementBuilder, const TDesC& aSection)
{
    TInt 								theValue;
    if( iDataWrapper.GetIntFromConfig(aSection, KType(), theValue) )
    {
        TUint8 type = theValue;

        if( iDataWrapper.GetIntFromConfig(aSection, KSizeDesc(), theValue) )
        {
            TUint8 sizeDesc = theValue;

            TPtrC	theString;
            if( iDataWrapper.GetStringFromConfig(aSection, KData(), theString) )
            {
                HBufC8*	theString8 = HBufC8::NewLC(theString.Length());
                theString8->Des().Copy(theString);
                TPtrC8	stringPtr=theString8->Des();
                TRAPD(err, aElementBuilder.BuildUnknownL(type, sizeDesc, stringPtr));
                if(err != KErrNone)
                {
                    iDataWrapper.ERR_PRINTF2(_L("MSdpElementBuilder BuildUnknownL failed with error %d"), err);
                    iDataWrapper.SetError(err);
                }
                CleanupStack::PopAndDestroy(theString8);
            }
            else
            {
                iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KData());
                iDataWrapper.SetBlockResult(EFail);
            }
        }
        else
        {
            iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KData());
            iDataWrapper.SetBlockResult(EFail);
        }
    }
    else
    {
        iDataWrapper.ERR_PRINTF2(_L("Missing parameter %S"), &KData());
        iDataWrapper.SetBlockResult(EFail);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:46,代码来源:T_DataSdpElementBuilder.cpp

示例2: i

HBufC8 *CemailTest::GetNextStringLC ( CStifItemParser& aItem, const TDesC &aName )
	{
	TPtrC nodename;
	nodename.Set( KNullDesC );

    TInt i( aItem.GetNextString ( nodename ) );
    if ( i != KErrNone ) 
	    {
	    iLog->Log( _L( "ERROR Reading '%S' argument: 0x%X" ), &aName, i );
	    }
	else
		{
		iLog->Log( _L("%S: %S"), &aName, &nodename);
		}
	
	HBufC8 *buf = HBufC8::NewLC( nodename.Length() ) ;
	buf->Des().Copy( nodename );
	
	return buf;
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:20,代码来源:emailtestBlocks.cpp

示例3: ReadStringParam

//Util function
void CTestIfioctls::ReadStringParam(char* aString)
	{
	_LIT( KSl, "Param%d" );
   	TBuf<8> pNameBuf;
    TPtrC string;
    pNameBuf.Format(KSl,++iParamCount);
	TBool res = GetStringFromConfig(ConfigSection(), pNameBuf, string);
	if(!res)
	 	{
	 	_LIT(Kerr , "Unable to retrieve string parameter") ;
	 	INFO_PRINTF1(Kerr);
	  	}
	TBuf8<256> bufstring;
	bufstring.Copy(string);
	TInt paramLength=string.Length();
	char* text=(char *)(bufstring.Ptr());
 	*(text+paramLength)='\0';
	strcpy(aString,text);
	return;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:21,代码来源:tifioctlsblocks.cpp

示例4: SetTextL

void CPreviewPopUpContent::SetTextL(const TDesC& aFirstText, 
                                    const TDesC& aSecondText, 
                                    const TDesC& aThirdText)
{
   TBuf<256> wrappedText;
   AknTextUtils::WrapToStringL(aSecondText, *iStringLengths, 
                               *iLabelContainer[1].iLabel->Font(), 
                               wrappedText);
   
   iLabelContainer[0].iLabel->SetTextL(aFirstText);
   iLabelContainer[0].iLabel->CropText();

   _LIT(KNewLine, "\n");
   TInt pos = wrappedText.Find(KNewLine);
   if (pos != KErrNotFound) {
      TPtrC leftText = wrappedText.Left(pos);
      iLabelContainer[1].iLabel->SetTextL(leftText);
      TPtrC rightText = wrappedText.Mid(pos + 1);
      if (rightText.Length() < 1) {
         // WrapToStringL always seems to add a newline so we need to 
         // check for length as well.
         iLabelContainer[2].iLabel->SetTextL(aThirdText);
         iLabelContainer[2].iLabel->CropText();
         iLabelContainer[3].iLabel->SetTextL(KDefaultText);
      } else {
         iLabelContainer[2].iLabel->SetTextL(rightText);
         iLabelContainer[2].iLabel->CropText();
         iLabelContainer[3].iLabel->SetTextL(aThirdText);
         iLabelContainer[3].iLabel->CropText();
      }
   } else {
      // WrapToStringL didnt add a newline (we dont need to wrap) but it
      // seems WrapToStringL always adds newline (see above comment).
      iLabelContainer[1].iLabel->SetTextL(aSecondText);
      iLabelContainer[2].iLabel->SetTextL(aThirdText);
      iLabelContainer[2].iLabel->CropText();
      iLabelContainer[3].iLabel->SetTextL(KDefaultText);      
   }
   //iLabel->SetRect(iLabelRect);
   //iLabel->DrawDeferred();
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:41,代码来源:PreviewPopUpContent.cpp

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

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

示例7: FieldEnd

// ---------------------------------------------------------
// CMailToHandler::FieldEnd()
// ---------------------------------------------------------
//
TInt CMailToHandler::FieldEnd(const TDesC& aHeader)
	{
	CLOG_ENTERFN( "CMailToHandler::FieldEnd()" );

	TPtrC path = iParsedUrl->Des();
	TInt length = path.Length(); // length of the scheme
    TInt retVal = length;

    TInt startPos = FieldStart( aHeader );

	if( IsHeader( aHeader ) )
		{
        TInt temp = GetNextField( startPos );
        /* we need to subtract 1 if the result is 
           not equal to length because of the & or ? */
        retVal = ( temp == length ) ? length : ( temp - 1);
		}

	CLOG_LEAVEFN( "CMailToHandler::FieldEnd()" );

	return retVal;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:26,代码来源:MailToHandler.cpp

示例8: ProcessL

TInt CCmdExit::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());

// Print out param if any and stop.
param.Set( TfrLex::Peel(param));
if (param.Length() > 0) 
	Print(param);

Machine()->StopEngine();
return error;
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:22,代码来源:CCmdStandard.cpp

示例9: ComparisonForVariousCharsetsL

/** Compare the various character sets
@test
*/		
void CTestHtmlToCrtConverterBufferStep::ComparisonForVariousCharsetsL()
	{
	// Get different character sets from the ini file
	TPtrC	sourceData;
	GetStringFromConfig(ConfigSection(), KSourceText, sourceData);
	
	HBufC8*	tempSource = HBufC8::NewLC(sourceData.Length());
	tempSource->Des().Copy(sourceData);
	TPtr8	source(tempSource->Des());
	
	// Compare the source text with the text converted by the characterset converter
	if ( DoComparisonL(source) == 0 )
		{
		INFO_PRINTF1(KInfoComparisionSuccessful);
		}
	else
		{
		ERR_PRINTF1(KErrInComparison);
		SetTestStepResult(EFail);
		}
	CleanupStack::PopAndDestroy(tempSource);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:25,代码来源:TestHtmlToCrtConverterBufferStep.cpp

示例10: FormatListItemLC

// -----------------------------------------------------------------------------
// CLandmarksModel::FormatListItemLC
// Formats a list item to the following format "X\tlandmarkName\t"
// where X = icon index
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
HBufC* CLandmarksModel::FormatListItemLC(CPosLandmark& aLandmark)
    {
    // Extract name
    TPtrC name;
    aLandmark.GetLandmarkName(name);
    // 10 extra chars for icon index and column separator
    const TInt KExtraChars = 10;
    HBufC* formattedNameBuf = HBufC::NewLC(name.Length() + KExtraChars);
    TPtr formattedNamePtr = formattedNameBuf->Des();

    // Extract icon info
    TPtrC mbmIconFile;
    TInt iconIndex, maskIndex;
    TInt res = aLandmark.GetIcon(mbmIconFile, iconIndex, maskIndex);

    // Format list item
    if (res == KErrNone)
        {
        // Create icon and append it to icon array. 
        TRAPD(err, AppendIconL(mbmIconFile, iconIndex, maskIndex));
        if (err == KErrNone)
            {
            // Append the array index where the icon is appended
            formattedNamePtr.AppendNum(iIconList->Count() - 1);
            }
        else
            {
            formattedNamePtr.AppendNum(KDefaultIconIndex);
            }
        }
    else // res == KErrNotFound
        {
        formattedNamePtr.AppendNum(KDefaultIconIndex);
        }
    formattedNamePtr.Append(KTab);
    formattedNamePtr.Append(name);

    return formattedNameBuf;
    }
开发者ID:fedor4ever,项目名称:packaging,代码行数:46,代码来源:LandmarksModel.cpp

示例11: GetParameterCountL

// ---------------------------------------------------------
// CWtaiHandler::GetParameterCountL()
// ---------------------------------------------------------
//
TInt CWtaiHandler::GetParameterCountL()
	{
	CLOG_ENTERFN( "CWtaiHandler::GetParameterCount()" );

	// wtai://<library>/<function> (; <parameter>)*

	TInt retVal = 0;
	TPtrC path = RemoveSchemeFromUrlL( KWtai );
	TInt length = path.Length();

	/* Count for the amount of parameter */
	for( TInt i = 0; i < length; i++ )
		{
		if( path[i] == KSemiColon )
			{
			retVal++;
			}
		}

	CLOG_LEAVEFN( "CWtaiHandler::GetParameterCount()" );

	return retVal;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:27,代码来源:WtaiHandler.cpp

示例12: main

int main()
{
    int retval =ESuccess;
    wchar_t* mywcharstring = L"Hello Widechar String";
    int wchar_length= wcslen(mywcharstring);
    TPtrC myTptrc;
    retval = WcharpToTptrc16(mywcharstring, myTptrc);

    int buf_len = myTptrc.Length();
    if (retval ==ESuccess &&\
    wchar_length == buf_len  )
    {
    printf("wcharptotptrc16 boundary1 Passed\n");
    }
    else
    {
    assert_failed = true;
    printf("wcharptotptrc16 boundary1 Failed\n");
    }      
    testResultXml("test_wcharptotptrc16_boundary1");
	
	return 0;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:23,代码来源:test_wcharptotptrc16_boundary1.cpp

示例13: GetDeviceUiNameL

// ---------------------------------------------------------------------------
// If aDevExt contains a valid friendly name, the friendly name will be displayed;
// Otherwise, if the given name from the parameter of a notifier request is valid,
// the given name will be displayed;
// Otherwise, If aDevExt contains a valid device name, the name will be displayed;
// Otherwise, the a name will be created by this function.
// ---------------------------------------------------------------------------
//
void TBTNotifUtil::GetDeviceUiNameL( TDes& aNameBuf, 
            const CBtDevExtension* aDevExt, 
            const TDesC& aNameInParam,
            const TBTDevAddr& aAddr)
    {
    CBtDevExtension* tempDev( NULL );
    TPtrC namePtr;
    if ( aDevExt && 
         aDevExt->Device().IsValidFriendlyName() && 
         aDevExt->Device().FriendlyName().Length() != 0 )
        {
        // We always use the friendly name regardless of 
        // the device-name of the device is available or not.
        namePtr.Set( aDevExt->Device().FriendlyName() );
        }
    else 
        {
        // this will take care of name formating. Either the
        // name from iNameInParam or the address will be
        // the alias:
        tempDev = CBtDevExtension::NewLC( aAddr, aNameInParam );      
        namePtr.Set( tempDev->Alias() );
        }
    // Make sure no overflow:
    if ( aNameBuf.MaxLength() < namePtr.Length() )
        {
        aNameBuf.Copy( namePtr.Left( aNameBuf.MaxLength() ) );
        }
    else
        {
        aNameBuf.Copy( namePtr );
        }
    if ( tempDev )
        {
        CleanupStack::PopAndDestroy( tempDev );
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:45,代码来源:btnotifutil.cpp

示例14: SetItemsL

// Set grid items from a resource
void CSendGrid::SetItemsL(TInt aResourceId) {

    // Clear previous items if we already have an item array, otherwise create
    // it
    if ( iItemArray ) {
        iGrid->SetCurrentItemIndex(0);
        iItemArray->Reset();
        iGrid->HandleItemRemovalL();
    } else {
        iItemArray = new (ELeave) CDesCArrayFlat(12);
        iGrid->Model()->SetItemTextArray(iItemArray);
    }
    
    // Read items from the resource file
    TResourceReader reader;
    CCoeEnv::Static()->CreateResourceReaderLC(reader, aResourceId);
    TInt count = reader.ReadInt16();
    __ASSERT_ALWAYS(count == KSendGridNumItems,
                    User::Panic(KPanic, KPanicBadResource));
    for ( TInt i = 0; i < count; i++ ) {
        iCommands[i] = reader.ReadInt32();
        iSubGrids[i] = reader.ReadInt32();
        TBuf<32> buf;
        buf.Append('\t');
        buf.Append(KGridItemLabels[i]);
        buf.Append('\t');
        TPtrC ptr = reader.ReadTPtrC();
        __ASSERT_ALWAYS(ptr.Length() <= 30,
                    User::Panic(KPanic, KPanicBadResource));
        buf.Append(ptr);
        iItemArray->AppendL(buf);
    }    
    CleanupStack::PopAndDestroy(); // reader
    iGrid->HandleItemAdditionL();
    iGrid->SetCurrentItemIndex(0);
    iCurrentGrid = aResourceId;
}
开发者ID:0x0all,项目名称:s2putty,代码行数:38,代码来源:sendgrid.cpp

示例15: CloseL

/**
 * See JNI method __1close.
 * This is an internal wrapper method for handling Leaves.
 */
jint CloseL(JNIEnv *aEnv, jclass aClass, jint aHandle, jobject aOutputFilename)
{
    // Convert handle to pointer.
    CImportFile *file = reinterpret_cast<CImportFile*>(aHandle<<2);

    // Complete writing and get output filename from the agent.
    TInt err = file->WriteDataComplete();
    // Initialize output filename to aOutputFilename parameter.
    if (KErrNone == err)
    {
        // Get class handle to StringBuffer
        aClass = aEnv->GetObjectClass(aOutputFilename);
        // Get method ID to StringBuffer StringBuffer.append(String)
        jmethodID methodID = aEnv->GetMethodID(
                                 aClass, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
        if (0 == methodID)
        {
            ELOG(EJavaInstaller,
                 "FileWriter__1close: StringBuffer.append not found");
            err = KErrGeneral;
        }
        else
        {
            CSupplierOutputFile &output = file->OutputFileL(0);
            TPtrC outputFilename = output.FileName();
            // Create new Java String.
            jstring jOutputFilename =
                aEnv->NewString(outputFilename.Ptr(), outputFilename.Length());
            aEnv->CallObjectMethod(aOutputFilename, methodID, jOutputFilename);
        }
    }

    // Delete the CImportFile instance which is no longer used.
    delete file;
    return err;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:40,代码来源:filewriter.cpp


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