本文整理汇总了C++中TPtrC8::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC8::Find方法的具体用法?C++ TPtrC8::Find怎么用?C++ TPtrC8::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC8
的用法示例。
在下文中一共展示了TPtrC8::Find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ret
TInt CSatNotifySendSs::CheckSsStringValidity
(
TPtrC8 aSsString
)
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_1, "CSAT:: CSatNotifySendSs::CheckSsStringValidity");
TInt ret( KErrNone );
if ( !aSsString.Length() )
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_2, "CSAT:: CSatNotifySendSs::CheckSsStringValidity, String length is NULL");
// If length is zero
ret = KErrCorrupt;
}
_LIT8( KDtmf, "p");
_LIT8( KWild, "w");
_LIT8( KExpansionDigit, ".");
// SS string can contain only digits, star '*' and dash '#' characters.
if ( ( KErrNotFound != aSsString.Find( KDtmf ) )
|| ( KErrNotFound != aSsString.Find( KWild ) )
|| ( KErrNotFound != aSsString.Find( KExpansionDigit ) ) )
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_3, "CSAT:: CSatNotifySendSs::CheckSsStringValidity, Incompatible character found");
ret = KErrCorrupt;
}
return ret;
}
示例2: ReadAssignment
TInt CVBookmarkConverter::ReadAssignment( const TDesC8& aBuffer,
TInt& aPosition, TPtrC8& aTag, TPtrC8& aValue )
{
LOGGER_ENTERFN( "CVBookmarkConverter::ReadAssignment" );
TPtrC8 start = aBuffer.Mid( aPosition );
TInt assignment = start.Find( KVBMKAssignment );
TInt linefeed = start.Find( KVBMKLinefeed );
// Did we find the delimeter and the linefeed
if ( ( assignment == KErrNotFound) || ( linefeed == KErrNotFound ) )
{
return KErrNotFound;
}
// Linefeed must reside behind the delimeter
if ( linefeed <= assignment )
{
return KErrNotFound;
}
// Extract tag
aTag.Set( start.Left( assignment ) );
IgnoreSpaces( aTag );
// Extract value
aValue.Set( start.Mid( assignment + 1, ( linefeed - 1 ) - assignment ) );
IgnoreSpaces( aValue );
// update position
aPosition += ( linefeed + KVBMKLinefeed().Length() );
LOGGER_LEAVEFN( "CVBookmarkConverter::ReadAssignment" );
return KErrNone;
}
示例3: ptr
void
CContentWindowContainer::DataReceived(class MBrCtlLinkContent* aLinkContent,
const isab::DataGuiMess* aMess, const char *aUrl)
{
HBufC8* data = NULL;
HBufC* contentType = NULL;
HBufC* url = WFTextUtil::AllocLC(aUrl);
TPtr8 ptr(const_cast<unsigned char*>(aMess->getData()), aMess->getSize(), aMess->getSize());
TInt neck = ptr.Find(KNeck());
if (neck == KErrNotFound) {
data = HBufC8::NewLC( ptr.Length());
data->Des().Copy(ptr);
contentType = WFTextUtil::AllocLC("text/html");
} else {
TPtrC8 header = ptr.Left(neck);
TPtrC8 body = ptr.Mid(neck+4);
data = HBufC8::NewLC( body.Length());
data->Des().Copy(body);
TInt pos = header.Find(KLineEnd);
TPtrC8 rest = header;
while (pos != KErrNotFound) {
TPtrC8 tmp = rest.Left(pos);
rest.Set(rest.Mid(pos+2));
pos = rest.Find(KLineEnd);
TInt ctpos = tmp.FindF(KContentTypeMarker);
if (ctpos != KErrNotFound) {
TPtrC8 tmp2 = tmp.Mid(ctpos+KContentTypeMarker().Length());
TInt scpos = tmp2.Find(KSemiColon);
if (scpos == KErrNotFound) {
contentType = HBufC::NewLC(tmp2.Length());
contentType->Des().Copy(tmp2);
} else {
contentType = HBufC::NewLC(tmp2.Left(scpos).Length());
contentType->Des().Copy(tmp2.Left(scpos));
}
break;
}
}
if (!contentType) {
contentType = WFTextUtil::AllocLC("text/html");
}
}
/* contentType = RecognizeLC(*url, ptr); */
/* contentType = WFTextUtil::AllocLC("text/html"); */
aLinkContent->HandleResolveComplete(*contentType, KCharSet, data);
CleanupStack::PopAndDestroy(contentType);
CleanupStack::PopAndDestroy(data);
CleanupStack::PopAndDestroy(url);
}
示例4: DescriptionUrlPort
// -----------------------------------------------------------------------------
// CUpnpDevice::DescriptionUrlPort
// Retrun description URL port.
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CUpnpDevice::DescriptionUrlPort() const
{
if ( iAddress != TInetAddr( INET_ADDR( 0,0,0,0 ), 0) )
{
return iAddress.Port();
}
const TDesC8& url = DescriptionUrl();
if ( url.Length()> KHttp().Length() )
{
TPtrC8 addrAndPath = url.Right( url.Length() - KHttp().Length() );
TInt separIndex = addrAndPath.Find( KSepar() );
if ( separIndex == KErrNotFound )
{
return KDefaultDescriptionUrlPort;
}
TInt slashIndex = addrAndPath.Find( KSlash8() );
if ( slashIndex != KErrNotFound )
{
TPtrC8 port = addrAndPath.Mid(
separIndex + 1, slashIndex - separIndex
);
TLex8 lex( port );
TInt prt;
TInt err = lex.Val( prt );
if( KErrNone != err )
{
return KErrNotFound;
}
return prt;
}
else
{
TPtrC8 port = addrAndPath.Right(
addrAndPath.Length() - ( separIndex + 1 )
);
TLex8 lex( port );
TInt prt;
TInt err = lex.Val( prt );
if( KErrNone != err )
{
return KErrNotFound;
}
return prt;
}
}
return KDefaultDescriptionUrlPort;
}
示例5: DoSubmitL
void CTestFilter::DoSubmitL( RHTTPTransaction aTransaction )
{
RHTTPHeaders hdr = aTransaction.Request().GetHeaderCollection();
RStringF fieldname = aTransaction.Session().StringPool().StringF(HTTP::EUserAgent,RHTTPSession::GetTable());
TBool found = EFalse;
TPtrC8 rawFieldData;
hdr.GetRawField(fieldname, rawFieldData);
found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound;
if(!found)
hdr.SetFieldL(fieldname, iUserAgent);
if( iHaveCredentials )
{
TBuf8<KB64KeySize> keyBase64(_L8("Aladdin"));
TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));;
RString username = iStringPool.OpenStringL( keyBase64 );
CleanupClosePushL<RString>( username );
RString password = iStringPool.OpenStringL( keyBase64Username );
CleanupClosePushL<RString>( password );
EncodeBasicAuthL(username, password, aTransaction);
CleanupStack::PopAndDestroy(&password);
CleanupStack::PopAndDestroy(&username);
}
}
示例6: ptr
EXPORT_C HBufC8* CTestConfig::ReplaceLC(const TDesC8& aOld, const TDesC8& aNew, const TDesC8& aOldString)
{
HBufC8* rString = aOldString.AllocLC();
TInt oldLen = aOld.Length();
TInt newLen = aNew.Length();
if (!oldLen)
return rString;
for (TInt pos = 0; pos < rString->Length(); pos += newLen)
{
TPtrC8 ptrC = rString->Mid(pos);
TInt find = ptrC.Find(aOld);
if (find == KErrNotFound)
return rString;
pos += find;
if (newLen > oldLen)
{
rString = rString->ReAllocL(rString->Length() + newLen - oldLen);
CleanupStack::Pop();
CleanupStack::PushL(rString);
}
TPtr8 ptr(rString->Des());
ptr.Replace(pos, oldLen, aNew);
}
return rString;
}
示例7: GetTokenValue
// -----------------------------------------------------------------------------
// Get value for given id.
// -----------------------------------------------------------------------------
//
HBufC8* CConfigurationHandler::GetTokenValue( const TDesC8& aData,
const TDesC8& aKey )
{
if( aData.Find(aKey)==KErrNotFound )
{
return NULL;
}
// id is in the string
TLex8 lex(aData);
while( !lex.Eos() )
{
TPtrC8 token = lex.NextToken();
TInt spos = token.Find(aKey);
if( spos==KErrNotFound )
{
continue;
}
// key was found return value
TPtrC8 value = token.Right(token.Length()-aKey.Length());
HBufC8* retval = HBufC8::NewL(value.Length());
TPtr8 des = retval->Des();
des.Append(value);
return retval;
}
return NULL;
}
示例8: ValidateElementNsL
TBool CPolicyNormalizer::ValidateElementNsL(CSenElement* aAssertion)
{
CSenElement& element = AsElement();
RPointerArray<CSenNamespace>& namespaces = element.NamespacesL();
if(aAssertion->NamespaceURI().Length() < 1 )
{
TPtrC8 elementName = aAssertion->LocalName();
TInt location = elementName.Find(KColon);
if (location)
{
TPtrC8 nsPrefix = elementName.Left(location);
CSenNamespace* ns = NULL;
TInt count = namespaces.Count();
for (TInt i=0; i < count; i++)
{
ns = (namespaces)[i];
if(ns->Prefix().Compare(nsPrefix) == 0)
{
aAssertion->SetNamespaceL(ns->Prefix(),ns->URI());
return ETrue;
}
}
}
}
return EFalse;
}
示例9: Match
TBool CExampleResolver::Match(const TDesC8& aImplementationType,
const TDesC8& aMatchType,
TBool aUseWildcards) const
{
TInt matchPos = KErrNotFound;
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aImplementationType.Find(dataSeparator);
if(separatorPos == KErrNotFound)
{
// Match against the whole string
if(aUseWildcards)
matchPos = aImplementationType.Match(aMatchType);
else
matchPos = aImplementationType.Compare(aMatchType);
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aImplementationType.Left(separatorPos);
TPtrC8 remainingData = aImplementationType.Mid(separatorPos + separatorLength);
// Match against each section in turn
while(separatorPos != KErrNotFound)
{
// Search this section
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
// If we found it then no need to continue, so return
if(matchPos != KErrNotFound)
return ETrue;
// Move on to the next section
separatorPos = remainingData.Find(dataSeparator);
if(separatorPos != KErrNotFound)
{
dataSection.Set(remainingData.Left(separatorPos));
remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
}
else
dataSection.Set(remainingData);
}
// Check the final part
if(aUseWildcards)
matchPos = dataSection.Match(aMatchType);
else
matchPos = dataSection.Compare(aMatchType);
}
return matchPos != KErrNotFound;
}
示例10: DescriptionUrlAddressL
// -----------------------------------------------------------------------------
// CUpnpDevice::DescriptionUrlAddressL
// Return description URL address.
// -----------------------------------------------------------------------------
//
EXPORT_C TInetAddr CUpnpDevice::DescriptionUrlAddressL() const
{
if ( iAddress == TInetAddr( INET_ADDR( 0,0,0,0 ), 0) )
{
const TDesC8& url = DescriptionUrl();
if ( url.Length()> KHttp().Length() )
{
TPtrC8 addrAndPath = url.Right( url.Length() - KHttp().Length() );
TInt index = addrAndPath.Find( KSepar() );
if ( index == KErrNotFound )
{
index = addrAndPath.Find( KSlash8() );
}
if ( index == KErrNotFound )
{
return TInetAddr( INET_ADDR( 0,0,0,0 ), 0 );
}
TPtrC8 addr = addrAndPath.Left( index );
TInetAddr address;
HBufC* addrBuf = HBufC::NewLC(addr.Length());
addrBuf->Des().Copy(addr);
address.Input(*addrBuf);
CleanupStack::PopAndDestroy(addrBuf);
return address;
}
return TInetAddr(INET_ADDR( 0,0,0,0 ), 0 );
}
return iAddress;
}
示例11: IsNewSection
TBool CTestConfig::IsNewSection(const TDesC8& aSource, const TLex8& aInput) const
/**
* Checks whether the current marked token in aInput starts with a '[' and ends with a ']',
* and checks that this token is at the start of a line.
*
* @returns Whether this is a new section in the script file
*/
{
const TPtrC8 token(aInput.MarkedToken());
const TInt offset(aInput.MarkedOffset());
TBool ret = token.Length() > 2 && token.Find(KScriptSectionStart) == 0;
ret = ret && token.Find(KScriptSectionEnd) != KErrNotFound;
if (ret && offset > 0)
{
const TPtrC8 lastChar(aSource.Mid(offset-1, 1));
ret = ret && (lastChar == KScriptLF || lastChar == KScriptCR);
}
return ret;
}
示例12: MatchServiceCmd
TBool CAiwResolver::MatchServiceCmd(const TDesC8& aOpaqueData, const TDesC8& aServiceCmd) const
{
_LIT8(dataSeparator, "||");
const TInt separatorLength = dataSeparator().Length();
// Look for the section separator marker '||'
TInt separatorPos = aOpaqueData.Find(dataSeparator);
if (separatorPos == KErrNotFound)
{
if (aServiceCmd.Compare(aOpaqueData) == 0)
{
return ETrue;
}
}
else
{
// Find the first section, up to the separator
TPtrC8 dataSection = aOpaqueData.Left(separatorPos);
TPtrC8 remainingData = aOpaqueData.Mid(separatorPos + separatorLength);
// Match against each section in turn
while (separatorPos != KErrNotFound)
{
if (dataSection.Compare(aServiceCmd) == 0)
{
return ETrue;
}
// Move on to the next section
separatorPos = remainingData.Find(dataSeparator);
if (separatorPos != KErrNotFound)
{
dataSection.Set(remainingData.Left(separatorPos));
remainingData.Set(remainingData.Mid(separatorPos + separatorLength));
}
else
{
dataSection.Set(remainingData);
}
}
if (dataSection.Compare(aServiceCmd) == 0)
{
return ETrue;
}
}
return EFalse;
}
示例13: ParseLicenseL
// ---------------------------------------------------------
// CDdEng::ParseLicenseL()
// ---------------------------------------------------------
//
void CDdEng::ParseLicenseL()
{
HBufC8* descriptorBuf = CodUtil::ConvertLC( iCodBuf->Des());
TPtrC8 license;
TPtrC8 descriptor (descriptorBuf->Ptr());
TInt startTag = descriptor.Find(KLicenseStartTag); // "<license"
if (startTag != KErrNotFound)
{
descriptor.Set(descriptor.Right(descriptor.Length()- startTag -1));
TInt endTag = descriptor.Locate(KElementEnd); //'>'
if (endTag != KErrNotFound)
{
license.Set(descriptor.Right(descriptor.Length()-endTag-1));
TInt licenseTagEnd = license.Find(KLicenseEndTag); // "</license"
if (licenseTagEnd != KErrNotFound)
{
license.Set(license.Left(licenseTagEnd));
}
}
}
iSaver->AppendData( license );
CleanupStack::PopAndDestroy( descriptorBuf );
}
示例14: ValueTokensL
TInt CSenPropertiesElement::ValueTokensL(const TDesC8& aDelimiter,
RPointerArray<TPtrC8>& aTokens)
{
TPtrC8 content = this->Content();
TInt delim = content.Find(aDelimiter);
while ( delim != KErrNotFound )
{
TPtrC8* piece = new (ELeave) TPtrC8();
piece->Set(content.Mid(0,delim));
aTokens.Append(piece);
content.Set(content.Mid(delim+aDelimiter.Length(),
content.Length()-(delim+aDelimiter.Length())));
delim = content.Find(aDelimiter);
}
if(!(this->Content()!=KNullDesC8 && content==KNullDesC8))
{
// If this property does NOT zero-length content
// and the "last" (or first) token is KNullDesC8
// it means that the string ends with delimiter;
// Therefore, KNullDesC8 must NOT be added as a
// result of "tailing delimiter".
// Add all other tokens here; even KNullDesC8
// gets added, if it is eiher first or
TPtrC8* token = new (ELeave) TPtrC8();
token->Set(content);
aTokens.Append(token);
}
if (aTokens.Count() == 0)
{
return KErrNotFound;
}
return KErrNone;
}
示例15: pos
void CSatNotifySendSs::CheckCallForwarding
(
TPtrC8 aSource,
RSat::TSsString& aSsString
)
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKCALLFORWARDING_1, "CSAT:: CSatNotifySendSs::CheckCallForwarding");
_LIT8(KCFU,"*21*"); // Call forwarding unconditional (CFU)
_LIT8(KCFB,"*67*"); // Call forwarding on Mobile Subscriber Busy(CFB)
_LIT8(KCFNRy, "*61*"); // Call forwarding on No Reply (CFNRy)
_LIT8(KCFNRc, "*62*"); // Call forwarding on Mobile Subscriber Not
// Reachable (CFNRc)
// Try to find call forwarding string
TInt pos( aSource.Find( KCFU ) );
if ( KErrNotFound == pos )
{
pos = aSource.Find( KCFB );
}
if ( KErrNotFound == pos )
{
pos = aSource.Find( KCFNRy );
}
if ( KErrNotFound == pos )
{
pos = aSource.Find( KCFNRc );
}
if ( KErrNotFound != pos )
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKCALLFORWARDING_2, "CSAT:: CSatNotifySendSs::CheckCallForwarding, String is for call forwarding");
aSsString.iSsString.Zero();
aSsString.iSsString.Append( aSource.Left( pos + 4 ) );
aSsString.iSsString.Append( KPlusMarkCharacterCode );
aSsString.iSsString.Append(
aSource.Right( aSource.Length() - ( pos + 4) ) );
}
}