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


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

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


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

示例1: VerifyWtaiSchemeL

// ---------------------------------------------------------
// CWtaiHandler::VerifyWtaiSchemeL()
// ---------------------------------------------------------
//
TInt CWtaiHandler::VerifyWtaiSchemeL( TPtrC path )
    {
	TInt colonPos = path.Locate( ';' ); // first occurance

	if ( colonPos <= 0 )
		{
 		User::Leave( KErrGeneral );
		}
    else if( KErrNotFound == path.FindF( KWP() ) ) // check if it's valid library
        {
        User::Leave( KErrUnsuppLibrary );
        }
    else if( ( KErrNotFound != path.FindF( KMC() ) ) ||
             ( KErrNotFound != path.FindF( KSD() ) ) ||
             ( KErrNotFound != path.FindF( KAP() ) ) ) // check if it's valid function
        {
        return colonPos;
        }
    else
        {
        User::Leave( KErrUnsupFunction );
        }

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

示例2: ReadLine

TPtrC TLineBuffer::ReadLine()
	{
	// Class nvariant: iRemainder == iTail.Length()
	ASSERT(iRemainder == iTail.Length());

	TInt end = iTail.Locate('\n');
	if (end < 0)
		{
		// Buffer ends without ending '\n', treat as line
		end = iTail.Length();
		iRemainder = 0;
		}
	else
		{
		// 0 <= end < iTail.Length() => iTail.Length() > iRemainder >= 0
		// (remainder is always decreased at least by 1, skipping '\n',
		// and will never become negative, because end < remainder)
		iRemainder -= end + 1;		
		// Ignore CR before LF, if present
		if (end > 0 && iTail[end-1] == '\r')
			--end;
		}
	const TPtrC line(iTail.Left(end));
	iTail.Set(iTail.Right(iRemainder));
	return line;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:26,代码来源:ws_eng.cpp

示例3: GetSubStringCount

/**
Counts the number of substrings (separated by KSubStringSeparators) in the text. 
Needed for correct memory allocations.
*/
TInt CResourceLoader::GetSubStringCount(const TDesC& aText)
    {
    TInt subCount = 0;
    TInt i = 0;

    while (i < aText.Length())
        {
        TPtrC remainder = aText.Right(aText.Length() - i);
        TInt nextKey = remainder.Locate(KSubStringSeparator);
        i += nextKey;

        // Always increase subcount, as a string without any separators counts as one substring.
        // However, if string length is zero, then there are no substrings.
        subCount++;

        if (nextKey != KErrNotFound && i < aText.Length() - 1)
            {
            i++; // skip separator
            }
        else
            break;
        }

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

示例4: EditableItemText

TPtrC CEikListBoxTextEditor::EditableItemText(TRect* aRect)
	{
	_AKNTRACE_FUNC_ENTER;
    TPtrC itemtext = ItemText();
	if (iItemPos==0)	// not yet set (and even if set, cannot be zero)
		{
		iItemPos = itemtext.Locate('\n');	// loacte partly editable item start
	    if (iItemPos != KErrNotFound)
			{
			iItemPos++;		// jump over mark character
			iItemLen = itemtext.Mid( iItemPos ).Locate('\n');	// locate string end
			if ( iItemLen == KErrNotFound )
				Panic( ETUiklbedPanicEndMarkMissing );
			if ( iItemLen==0 )
				Panic( ETUiklbedPanicEmptyField );
			TPtrC head = itemtext.Left( iItemPos );
			TPtrC body = itemtext.Mid( iItemPos, iItemLen );
			if ( aRect ) // adjust the rect if it is given
				{
				aRect->iTl.iX += iFont->TextWidthInPixels( head );
				aRect->iBr.iX = aRect->iTl.iX + iFont->TextWidthInPixels( body ) + 4;
				}
			_AKNTRACE_FUNC_EXIT;
			return body;
			}
		iItemPos = 0; // partly editable text not found
		}
	_AKNTRACE_FUNC_EXIT;
	return itemtext;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:30,代码来源:EIKLBED.CPP

示例5: ExtractSID

/**
The function parses thr database file name argument and extracts the SID from it (if the name contains SID).
The SID is expected to be found at position 0 of the file name and must have 8 hex digits.

@param aDbFileName Database file name

@return Database security UID or KNullUid if the database name does not contain SID.

@internalComponent
*/
static TUid ExtractSID(const TDesC& aDbFileName)
	{
	TParsePtrC parse(aDbFileName);//this call may panic if aDbFileName cannot be parsed, but SetL() already parsed it
	TPtrC dbName = parse.Name();
	TInt pos1 = dbName.Locate(TChar('['));
	TInt pos2 = dbName.Locate(TChar(']'));
	if(pos1 == 0 && pos2 == 9)	//position 0 for '[', 8 digits SID, position 9 for ']'
		{
		TLex lex(dbName.Mid(pos1 + 1, pos2 - pos1 - 1));
		TUid securityUid;
		TInt err = lex.Val(*(TUint32*)&securityUid, EHex);
		if(err == KErrNone)
			{
			return securityUid;	
			}
		}
	return KNullUid;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:SqlSrvFileData.cpp

示例6: ConstructL

void CUrl::ConstructL(const TDesC& aUrl)
//
//	Non-trivial c'tor - can be used for all general urls
	{
	// Stripe any leading whitespace
	TPtrC url = aUrl;
	while( url.Locate(' ') == 0 )
		{
		// Remove the leading whitespace -> set pointer to second character
		url.Set(url.Mid(1));
		}
	iUrlDes = url.AllocL();

	// Check to see if there's ':' at start of aUrl
	TInt colonPos = aUrl.Locate(':');
	if (colonPos == 0)
		User::Leave(EWapErrCorruptUrl);
	TPtrC scheme(Component(EUrlScheme));
	CheckSchemeValidL(scheme);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:20,代码来源:URLBASE.cpp

示例7: ColumnText

EXPORT_C TInt TextUtils::ColumnText(TPtrC& aColumnText,TInt aColumn,const TDesC* aSourceText,TChar aColumnSeparator)
/** Gets a portion of text from a descriptor, corresponding to a requested column.

@param aColumnText On return, set to the portion of aSourceText that corresponds 
to the column aColumn.
@param aColumn The column to extract. The first column is numbered zero.
@param aSourceText The source text string that contains one or more column 
separators.
@param aColumnSeparator The character used in aSourceText to separate the columns. 
By default, a tab character.
@return KErrNotFound if the column number is invalid, otherwise KErrNone. */
	{
	aColumnText.Set(TPtrC());
	TInt end=0;
	TInt column=0;
	TPtrC text;
	if (aSourceText)
		text.Set(*aSourceText);
	while (text.Length())
		{
		end=text.Locate(aColumnSeparator);
		if (end==KErrNotFound)
			end=text.Length();
		if (column==aColumn)
			{
			aColumnText.Set(text.Left(end));
			return(KErrNone);
			}
		else if (++column>aColumn)
			break;
		if (end<text.Length())
			++end;
		text.Set(text.Mid(end));
		}
	return(KErrNotFound);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:36,代码来源:GULUTIL.CPP

示例8: DrawItemText


//.........这里部分代码省略.........
                {
                if ( TextUtils::ColumnText( itemText, i, targetptr ) == KErrNotFound )
                    {
                    break;
                    }
                
                if ( itemText != KNullDesC )
                    {
                    swapCells = EFalse;
                    break;
                    }
                }
            
            TextUtils::ColumnText( itemText, 1, targetptr );

            if ( swapCells && itemText.Length() > 0 )
                {
                TPtrC secondaryText;
                TextUtils::ColumnText( secondaryText, 5, targetptr );
            
                // remove text from the first text cell
                AknLAFUtils::ReplaceColumn( des, targetptr, (TDesC16*)&KNullDesC, KColumnListSeparator, 1 );

                // ReplaceColumn does not update descriptor's length :(
                des.Set( buffer ? buffer->Des() : target.Des() ); 
                
                TInt secondaryPos = 0;
                TPtrC temp;
                temp.Set( des );

                // add separators if needed
                for ( TInt i = 0; i < 5; ++i )
                    {
                    TInt position = temp.Locate( KColumnListSeparator );
                    
                    if ( position != KErrNotFound )
                        {
                        if ( position < temp.Length() )
                            {
                            ++position;
                            }
                            
                        secondaryPos += position;
                        }
                    else
                        {
                        des.Append( KColumnListSeparator );
                        secondaryPos = des.Length();
                        }

                    temp.Set( des.Mid( secondaryPos ) );
                    }
                
                des.Insert( secondaryPos, itemText );

                if ( secondaryText != KNullDesC )
                    {
                    _LIT( KEmptySpace, " " );
                    des.Insert( secondaryPos + itemText.Length(), KEmptySpace );
                    }
                    
                targetptr = &des;
                }
            }
        else
            {
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:67,代码来源:eikslb.cpp

示例9: DrawActualItem

//
// Draws the item, which might contain an icon and a text.
// The format of the item text shall look like one of the following formats:
//		- "\ttext"				(text only)
//		- "icon\ttext"			(icon and text)
//		- "\theading\ttext"		(heading and text)
//		- "icon\theading\ttext"	(icon, heading and text)
//		
void CMediaScreenListItemDrawer::DrawActualItem(TInt aItemIndex,
		const TRect& aActualItemRect, TBool aItemIsCurrent,
		TBool /*aViewIsEmphasized*/, TBool /*aViewIsDimmed*/,
		TBool aItemIsSelected) const
	{
	const MDesCArray* itemArray = iListBox.Model()->ItemTextArray();
	if ((!itemArray) || (itemArray->MdcaCount() <= aItemIndex))
		return;
    
	// Gets the item text if the conditions above are met.
	TPtrC itemText = itemArray->MdcaPoint(aItemIndex);

	// We have to find the position of tabs to decide the components
	// available in the item text (icon, heading and text).
	TInt tabPosition1 = itemText.Locate('\t');
	TInt tabPosition2 = itemText.Mid(tabPosition1 + 1).Locate('\t');
	if (tabPosition2 >= 0)
		{
		// We need to add tabPosition1 because the return value of
		// Locate() is relative to tabPosition1.
		tabPosition2 += tabPosition1 + 1;
		}
	TInt tabPosition3 = itemText.Mid(tabPosition2 + 1).Locate('\t');
	if (tabPosition3 >= 0)
		{
		// We need to add tabPosition2 because the return value of
		// Locate() is relative to tabPosition2.
		tabPosition3 += tabPosition2 + 1;
		}
	TInt tabPosition4 = itemText.Mid(tabPosition3 + 1).Locate('\t');
	if (tabPosition4 >= 0)
		{
		// We need to add tabPosition2 because the return value of
		// Locate() is relative to tabPosition2.
		tabPosition4 += tabPosition3 + 1;
		}

	// Sets the attributes to draw the icon.
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	if ((aItemIsCurrent) || (aItemIsSelected))
		{
		iGc->SetBrushColor(iHighlightedBackColor);
		}
	else
		{
		iGc->SetBrushColor(iBackColor);
		}

	// Gets the icon index, i.e. the number in the text item before
	// the first tab.
	TInt iconIndex = 0;
	if (tabPosition1 > 0)
		{
		TLex(itemText.Mid(0, tabPosition1)).Val(iconIndex);
		}

		TRect aActualItemRect2 = aActualItemRect;

		aActualItemRect2.iBr.iX = aActualItemRect2.iBr.iX + 0;
		aActualItemRect2.iBr.iY = aActualItemRect2.iBr.iY + 0;
		aActualItemRect2.iTl.iX = aActualItemRect2.iTl.iX + 0;
		aActualItemRect2.iTl.iY = aActualItemRect2.iTl.iY + 10;

	if ((iIconArray) && (iIconArray->Count() > iconIndex)
		&& (tabPosition1 > 0))
		{
		// Draws the icon.
		CFbsBitmap* bitmap = (*iIconArray)[iconIndex]->Bitmap();
		iGc->BitBltMasked(
			aActualItemRect2.iTl,
			bitmap,
			TRect(TPoint(0, 0), bitmap->Header().iSizeInPixels),
			(*iIconArray)[iconIndex]->Mask(),
			ETrue);

		// Draws the rectangle, just in case there are some icons that are
		// smaller than the height of item width and/or height.
		iGc->SetPenStyle(CGraphicsContext::ENullPen);
		if (bitmap->Header().iSizeInPixels.iHeight < aActualItemRect2.Height())
			{
			TRect rect(
				aActualItemRect2.iTl.iX,
				aActualItemRect2.iTl.iY + bitmap->Header().iSizeInPixels.iHeight,
				aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect2.iBr.iY);
			
			TRect rect1(
				aActualItemRect2.iTl.iX,
				aActualItemRect2.iTl.iY - 10,
				aActualItemRect2.iTl.iX + iMaxIconSize.iWidth,
				aActualItemRect2.iBr.iY - 40 );

//.........这里部分代码省略.........
开发者ID:deepakprabhakara,项目名称:ripplevault,代码行数:101,代码来源:mediascreenlistbox.cpp

示例10: ResolveSubStringL

/**
Resolves sub string and directionality of the sub string.
Adds no dir marker if directionality of the string not found.
*/
HBufC* CResourceLoader::ResolveSubStringL(TDes& aText, TBool* aMarker)
    {
    // Allocating heap buffer for return string.
    TInt destlength(aText.Length());
    HBufC* retbuf = HBufC::NewLC(destlength + 1); // no dir marker
    TPtr retptr(retbuf->Des());
    
    TBuf<1> marker;
    marker.Append(KDirNotFound);
        
    TPtrC remainder = aText.Right(aText.Length());
    TInt nextKey = remainder.Locate(KSubStringSeparator);
    
    if (nextKey == 0)
        {
        remainder.Set(remainder.Mid(1));
        nextKey = remainder.Locate(KSubStringSeparator);
        if (nextKey != KErrNotFound)
            {
            retptr.Insert(0, aText.Mid(1, nextKey));           
            // Remove string from aText
            aText.Delete(0, nextKey + 1);
            }
        else
            {
            TInt length = aText.Length();
            retptr.Insert(0, aText.Mid(1, length - 1));
            // Remove string from aText
            aText.Delete(0, length);
            }
        }
    else if (nextKey == KErrNotFound)
        {
        retptr.Insert(0, aText); 
        // Remove string from aText
        aText.Delete(0, aText.Length());
        }
    else
        {
        retptr.Insert(0, aText.Mid(0, nextKey));
        // Remove string from aText
        aText.Delete(0, nextKey);
        }
     
    // Resolve directionality of sub string
    HBufC* dirbuf = retbuf->AllocL();
    TPtr dirptr = dirbuf->Des();
    TBool found(EFalse);
    TBidiText::TDirectionality mainDir = ResolveDirectionality(dirptr, &found);
    delete dirbuf;
    
    if (!found)
        {
        retptr.Insert(0, marker);
        *aMarker = ETrue;
        }
    else
        {
        *aMarker = EFalse;
        }
        
    retbuf = retbuf->ReAllocL(retptr.Length());
    CleanupStack::Pop(); //retbuf
    // If the key string wasn't found, retbuf is empty.
    return retbuf;     
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:70,代码来源:basepluginresourceloader.cpp

示例11: PartOfAuthority

void CUrl::PartOfAuthority(TComponent aComponent, const TDesC& aUrl, TInt& aStartPos, TInt& aEndPos) const
	{
	if (aEndPos < aStartPos)
		{
		// We don't have what the user asked for
		aStartPos = KCUrlInvalidCharPos;
		aEndPos = KCUrlInvalidCharPos;
		return;
		}

	TPtrC authority = aUrl.Mid(aStartPos, aEndPos - aStartPos);
	TInt endPos = aEndPos - aStartPos;
	TInt colonPos = authority.Locate(':');
	TInt atPos = authority.Locate('@');
	if (atPos == KErrNotFound)
		{
		// There isn't a username or password.
		if (aComponent != EUrlLocation)
			{
			// We don't have what the user asked for
			aStartPos = KCUrlInvalidCharPos;
			aEndPos = KCUrlInvalidCharPos;
			}
		// Else all we've got is the location, so we can return
		// without doing anything
		return;
		}

	// We have an @.
	if (aComponent == EUrlLocation)
		{
		if (atPos != endPos - 1)
			{
			// We have a location of non-zero length
			aStartPos += atPos + 1;
			return;
			}
		else
			{
			aStartPos = KCUrlInvalidCharPos;
			aEndPos = KCUrlInvalidCharPos;			
			}
		}
	else
		{
		// Either username or password
		if (aComponent == EUrlUsername)
			{
			if (colonPos == KErrNotFound || colonPos > atPos)
				{
				// No password
				aEndPos = aStartPos + atPos - 1;
				return;
				}
			else
				{
				aEndPos = aStartPos + colonPos - 1;
				return;
				}
			}
		else
			{
			// They want the password
			if (colonPos == KErrNotFound || colonPos > atPos)
				{
				// There isn't a password
				aStartPos = KCUrlInvalidCharPos;
				aEndPos = KCUrlInvalidCharPos;
				}
			else
				{
				aEndPos = aStartPos + atPos - 1;
				aStartPos += colonPos + 1;
				}
			}
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:77,代码来源:URLBASE.cpp

示例12: ResolveDirectionality

/**
Resolves directionality of the given source text.
Place-holder strings are removed so that they don't affect the result.
*/
TBidiText::TDirectionality CResourceLoader::ResolveDirectionality(TDes& aText, TBool* aFound)
    {
    TInt i = 0;

    // Remove place-holders from string so they don't affect directionality
    // length parameters e.g. "[29]" do not contain strongly directional
    // characters so can ignore them.
    while (i < aText.Length())
        {
        TPtrC remainder = aText.Right(aText.Length() - i);
        TInt nextKey = remainder.Locate(KKeyPrefix);
        i += nextKey;

        if (nextKey != KErrNotFound && i < aText.Length() - 1)
            {
            TInt lastCharInKey = i + 1;

            // skip possible key index
            TText t = aText[lastCharInKey];
            if (t >= '0' && t <= '9')
                {
                lastCharInKey++;

                if (lastCharInKey < aText.Length())
                    {
                    t = aText[lastCharInKey];
                    if (t >= '0' && t <= '9')
                        {
                        lastCharInKey++;
                        }
                    }
                }

            // lastCharInKey is now the index of 'N' or 'U' in the key

            if (lastCharInKey < aText.Length())
                {
                TText t = aText[lastCharInKey];
                if (t == 'U' || t == 'N')
                    {
                    // found key, delete it and continue loop to
                    // search for the next key
                    aText.Delete(i, lastCharInKey - i + 1);
                    }
                // This was not a proper key - check the remaining string
                else
                    {
                    i = lastCharInKey + 1;
                    }
                }
            // end of string encountered - stop
            else
                {
                break;
                }
            }
        // no key found - stop
        else
            {
            break;
            }
        }

    return TBidiText::TextDirectionality(aText, aFound);
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:69,代码来源:basepluginresourceloader.cpp

示例13: ParseCommandLine

void ParseCommandLine ()
	{
	TBuf<64> c;
	
	User::CommandLine(c);
	c.LowerCase();

	if (c != KNullDesC)
		{
		TLex lex(c);
		TPtrC token;

		while (token.Set(lex.NextToken()), token != KNullDesC)
			{
			if (token.Mid(0) == _L("quiet"))
				{
				gQuiet = ETrue;
				continue;
				}

			if (token.Mid(0) == _L("verbose"))
				{
				gQuiet = EFalse;
				continue;
				}

			if (token.Left(5) == _L("chunk"))
				{
				TInt equalPos;
				equalPos = token.Locate('=');
				if (equalPos > 0 && (equalPos+1) < token.Length())
					{
					TLex lexNum(token.Mid(equalPos+1));
					lexNum.Val(gChunkSize,EDecimal);	
					}
				continue;
				}

			if (token.Left(3) == _L("low"))
				{
				TInt equalPos;
				equalPos = token.Locate('=');
				if (equalPos > 0 && (equalPos+1) < token.Length())
					{
					TLex lexNum(token.Mid(equalPos+1));
					lexNum.Val(gMin,EDecimal);	
					}
				continue;
				}

			if (token.Left(5) == _L("high"))
				{
				TInt equalPos;
				equalPos = token.Locate('=');
				if (equalPos > 0 && (equalPos+1) < token.Length())
					{
					TLex lexNum(token.Mid(equalPos+1));
					lexNum.Val(gMax,EDecimal);	
					}
				continue;
				}

			if (token.Left(6) == _L("period"))
				{
				TInt equalPos;
				equalPos = token.Locate('=');
				if (equalPos > 0 && (equalPos+1) < token.Length())
					{
					TLex lexNum(token.Mid(equalPos+1));
					lexNum.Val(gPeriod,EDecimal);	
					}
				continue;
				}

			if (token.Left(3) == _L("mem"))
				{
				TInt equalPos;
				equalPos = token.Locate('=');
				if (equalPos > 0 && (equalPos+1) < token.Length())
					{
					TLex lexNum(token.Mid(equalPos+1));
					lexNum.Val(gMemScheme,EDecimal);	
					}
				continue;
				}

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

示例14: SaveL


//.........这里部分代码省略.........
            CleanupStack::PopAndDestroy(2); //cmmanager,cm
            }

        //Get default access point in failure of getting AP
        if (ERROR != KErrNone || err1 != KErrNone)
			{
			apId = GetDefaultIAPL();
			}
		
		HBufC8* iapBuf = HBufC8::NewLC( 8 );
		TPtr8 ptrBuf = iapBuf->Des();
		ptrBuf.Num( apId );
		
		connection.SetPropertyL( KNSmlIAPId, *iapBuf );
			
        CleanupStack::PopAndDestroy(); //iapBuf	
		}
		
	if( iProfiles[aItem]->iHostAddress )
		{
		// see if address contains also port
		TBool portFound = EFalse;
		TInt startPos(0);
		if(iProfiles[aItem]->iHostAddress->Find(KNSmlDsProvisioningHTTP)==0)
		    {
		    startPos=KNSmlDsProvisioningHTTP().Length();		    		    
		    }
		else if(iProfiles[aItem]->iHostAddress->Find(KNSmlDsProvisioningHTTPS)==0)
		    {
		    startPos=KNSmlDsProvisioningHTTPS().Length();		    		    
		    }
		TPtrC uriPtr = iProfiles[aItem]->iHostAddress->Mid(startPos);
		
		if(uriPtr.Locate(KNSmlDMColon)!=KErrNotFound)
		    {
			portFound = ETrue;
		    }
	
		if( portFound == EFalse )
			{
			HBufC *uri = 0;
			// port not found from URI -> see if it is given separately				
			if( iProfiles[aItem]->iPort )
				{
				// parse address and port into URI
			
				if( CombineURILC( iProfiles[aItem]->iHostAddress->Des(),
							  iProfiles[aItem]->iPort->Des(), uri ) == KErrNone )
					{
					if(iProfiles[aItem]->iHostAddress)
					{
						delete iProfiles[aItem]->iHostAddress;
						iProfiles[aItem]->iHostAddress = NULL;
					}
					iProfiles[aItem]->iHostAddress = uri->Des().AllocL();
					}
				CleanupStack::PopAndDestroy(); // uri		  
				}
			else
				{
				// use default port
				if( CombineURILC( iProfiles[aItem]->iHostAddress->Des(),
							  KNSmlDsDefaultPort(), uri ) == KErrNone )
					{
					if(iProfiles[aItem]->iHostAddress)
					{
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:67,代码来源:NSmlDsProvisioningAdapter.cpp

示例15: nInd

/**
 * Finds the java attribute specified by
 * aAttributeName from aJad and returns the value of that attribute
 * in HBufC.
 * @param[in] aJad contents of Jad file
 * @param[in] aAttributeName the name of a java attribute
 * @return the value of the attribute. Caller gets the ownership of the
 * returned HBufC.
 * If the attribute is not found, returns NULL
 */
HBufC *CSilentMIDletInstall::ParseAttribute(const HBufC *aJad, const TDesC& aAttributeName)
{
    JELOG2(EJavaPreinstaller);

    TInt    nInd(0);
    TBool   fullNameFound(EFalse);
    TUint32 ch;

    // Start parsing from the beginning of the Jad file
    TPtrC parsePtr = aJad->Mid(nInd);

    do
    {
        // Find attribute name
        nInd = parsePtr.Find(aAttributeName);
        if (nInd < 0)
        {
            // Returns NULL if the attribute cannot be found
            return NULL;
        }

        // Check that the attribute name was preceded by line break or
        // it was at the beginning of the Jad file
        if (nInd == 0)
        {
            fullNameFound = ETrue;
        }
        else
        {
            ch = parsePtr[nInd-1];
            if ((ch == CR) || (ch == LF))
            {
                fullNameFound = ETrue;
            }
            else
            {
                // Name was just a part of longer string (not 'word match')
                fullNameFound = EFalse;
                // Skip to the last character of the found match.
                // We can skip because we are insterested only in 'word' matches
                // so the next cannot start inside the area we are skipping now.
                parsePtr.Set(parsePtr.Mid(nInd + aAttributeName.Length() - 1));
                continue;
            }
        }

        // Check whether Jad file ends after attribute name
        if (nInd + aAttributeName.Length() >= parsePtr.Length())
        {
            // Jad file ends immediately after the found
            // attribute name instance. No attribute value
            return NULL;
        }

        // Check that there is a white space character or colon after
        // attribute name
        ch = parsePtr[nInd + aAttributeName.Length()];
        if ((ch == COLON) || (ch == SP) || (ch == HT))
        {
            fullNameFound = ETrue;
        }
        else
        {
            // Name was just a part of longer string (not 'word match')
            fullNameFound = EFalse;
            // Skip to the next character after the found match
            parsePtr.Set(parsePtr.Mid(nInd + aAttributeName.Length()));
            continue;
        }
    }
    while (!fullNameFound);

    // Skip to the end of the attribute name and find ':' after the name.
    // The skipped characters must be white space chacraters, otherwise
    // the attribute name is illegal and Java Installer will not accept
    // the Jad file.
    parsePtr.Set(parsePtr.Mid(nInd + aAttributeName.Length() - 1));
    nInd = parsePtr.Locate(COLON);
    if (nInd < 0)
    {
        return NULL;
    }
    nInd++;

    // Parse attribute value (CR or LF ends)
    TInt nEndInd = parsePtr.Locate(CR);
    TInt nTmpInd = parsePtr.Locate(LF);

    if (KErrNotFound == nEndInd)
    {
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:101,代码来源:silentmidletinstall.cpp


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