本文整理汇总了C++中HBufC::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC::Find方法的具体用法?C++ HBufC::Find怎么用?C++ HBufC::Find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC
的用法示例。
在下文中一共展示了HBufC::Find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
CContentWindowContainer::DataReceived(const isab::DataGuiMess* aMess,
const char *aUrl)
{
list<class CResolveItem*>::iterator it = iReqList.begin();
if (iBrCtlInterface) {
class CResolveItem* item = NULL;
while (it != iReqList.end()) {
item = *it;
HBufC* url = WFTextUtil::AllocLC(aUrl);
if (!url->Find(item->getUrl())) {
CleanupStack::PopAndDestroy(url);
iReqList.erase(it);
DataReceived(item->getLinkContent(), aMess, aUrl);
delete item;
return;
}
CleanupStack::PopAndDestroy(url);
it++;
}
}
class CResolveItem* item;
while (it != iReqList.end()) {
item = *it;
it++;
iReqList.pop_front();
delete item;
}
}
示例2: CheckIfFooterMessageExistsL
/**
CheckIfFooterMessageExistsL()
Checks the email for the presence of the footer string
@param aRecvBodyText
Reference to a descriptor holding the body text
@param aFooterSize
The expected number of KB remaining on the server which has been inserted into the footer string
@return
ETrue if footer string found otherwise EFalse
*/
TBool CT_MsgComparePopEmailMsgs::CheckIfFooterMessageExistsL(TPtrC& aRecvBodyText , TInt& aFooterSize)
{
RResourceFile resFile;
CT_MsgUtils ::OpenResourceFileL(resFile, iFs, KImEngineResourceFile); // NB leaves if file not found
TCleanupItem close(CT_MsgUtils ::CloseResourceFile, &resFile);
CleanupStack::PushL(close);
HBufC8* buf = NULL;
buf = resFile.AllocReadLC(PARTIAL_DOWNLOAD_FOOTER_MESSAGE);
TResourceReader reader;
reader.SetBuffer(buf);
HBufC* resourceBuf = (reader.ReadTPtrC()).AllocL();
CleanupStack::PushL(resourceBuf);
TInt len = resourceBuf->Find(_L("%d"));
const TInt KBufLen = 256;
TBuf<KBufLen> findBuf;
if(len == KErrNotFound)
{
len = resourceBuf->Length();
}
if(len > KBufLen)
{
len = KBufLen;
}
findBuf.Copy(resourceBuf->Ptr(), len);
len = aRecvBodyText.Find(findBuf);
if(len>=0)
{
TPtrC rest=aRecvBodyText.Right(aRecvBodyText.Length()-len-findBuf.Length());
TLex lex(rest.Left(rest.Locate(TChar(' '))));
lex.Val(aFooterSize);
}
else
{
aFooterSize=0;
}
CT_MsgUtils ::CloseResourceFile(&resFile);
CleanupStack::PopAndDestroy(3); // buf, resourceBuf, close
return (len != KErrNotFound);
}
示例3: SetupAndRunTests
/**
* This function sets up a console, a log file and checks
* whether we need to wait for a key pressed after test
* completion.
* First DoThreadedTestsL is called, if everything is ok
* it return ETrue and we move on to the standard tests.
* If something went amiss (return EFalse) we skip
* the standard test and return.
*/
LOCAL_D void SetupAndRunTests()
{
CConsoleBase* console = Console::NewL(_L("Test code"), TSize(KConsFullScreen, KConsFullScreen));
HBufC* logFile = GetArgument(1);
if (logFile->Length()==0)
{
_LIT(defaultLog, "\\tcertstore.log");
TDriveUnit sysDrive (RFs::GetSystemDrive());
TDriveName sysdriveName (sysDrive.Name());
TBuf <18> fileName (sysdriveName);
fileName.Append(defaultLog);
logFile->ReAlloc(18);
TPtr16 plog = logFile->Des();
plog.Append(fileName);
}
HBufC* wait = GetArgument(2);
TBool waitAfterCompletion = EFalse;
if (wait->Find(_L("-w")) != KErrNotFound)
{
waitAfterCompletion = ETrue;
}
TBool res = EFalse;
TRAPD(err, res = DoThreadedTestsL(console, logFile, waitAfterCompletion));
if (res)
{
// Now run a normal tcertstore test to check store integrity
TRAP(err, DoTests());
}
delete console;
delete wait;
delete logFile;
}
示例4: NextSectionL
/*
-------------------------------------------------------------------------------
Class: CStifFileParser
Method: NextSectionL
Description: Finds n-th (aSeeked) section in file starting from m-th (aOffset) position
Parameters: const TDesc& aStartTag: in: Starting tag of a section
const TDesc& aEndTag: in: Ending tag of a section
TInt& aOffset: in out: Current offset in file (*)
TInt aSeeked: in: Which section is to be found
Notification: aOffset has different meaning than before adding INCLUDE functionality.
If it has 0 value, that means that we need to remove files stack and go
back to base file to the beginning. Otherwise we don't change current
file read-handler position.
Return Values: HBufC *: address of a descriptor containing section. Section is returned without tags.
Caller must take care about the freeing descriptor.
Errors/Exceptions: Leaves if aSeeked is less than 1 or aOffset is negative
Leaves if seek command leaves
Leaves if cannot allocate buffers
Leaves if cannot allocate section
Leaves if length of readed line exceeds KMaxLineLength constant
Status: Proposal
-------------------------------------------------------------------------------
*/
HBufC* CStifFileParser::NextSectionL(const TDesC& aStartTag,
const TDesC& aEndTag,
TInt& aOffset,
TInt aSeeked)
{
// Check arguments
if(aSeeked < 1)
{
User::Leave(KErrArgument);
}
if(aOffset < 0)
{
User::Leave(KErrArgument);
}
TInt foundSection = 0;
TInt ret;
// Alloc buffers to read line
const TInt KMaxLineLength = 4096; //If length of readed line exceeds this constant, method will leave
HBufC* buf = HBufC::NewL(KMaxLineLength);
CleanupStack::PushL(buf);
TPtr bufPtr(buf->Des());
HBufC* withoutCommentsBuf = HBufC::NewL(KMaxLineLength);
CleanupStack::PushL(withoutCommentsBuf);
TPtr withoutCommentsBufPtr(withoutCommentsBuf->Des());
HBufC* endOfLine = HBufC::NewL(8); //After reading a line it contains 0D0A or 0A or null (how readed line is ended)
CleanupStack::PushL(endOfLine);
TPtr endOfLinePtr(endOfLine->Des());
//Set valid position in file
//but only if offset shows to 0. Otherwise keep previus position
if(aOffset == 0)
{
User::LeaveIfError(iBaseFile.Seek(ESeekStart, aOffset));
ClearFileStack();
aOffset = 1;
}
//Prepare to read lines
TBool validSectionBeginFound = EFalse;
TBool validSectionEndFound = EFalse;
TSectionFind whatToFindSection = ESectionStart;
//If no start tag is given start to find end tag immediatly
if(aStartTag.Length() == 0)
{
foundSection++;
whatToFindSection = ESectionEnd;
validSectionBeginFound = ETrue;
}
if(aEndTag.Length() == 0)
{
validSectionEndFound = ETrue;
}
TWhatToFind whatToFind = EStart;
//Perform reading file
while(ReadLineL(bufPtr, endOfLinePtr))
{
if(iCommentType == CStifParser::ECStyleComments)
{
ReplaceCommentsLineL(bufPtr, withoutCommentsBufPtr, whatToFind);
}
else
{
//.........这里部分代码省略.........
示例5: PrepareIteratorL
// -----------------------------------------------------------------------------
// CSisxUIAppInfo::PrepareIteratorL
// Prepares the iterator to be shown in details dialog.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CSisxUIAppInfo::PrepareIteratorL( const Swi::CAppInfo& /*aInfo*/ )
{
FreeIterator();
iKeys = new( ELeave )CDesCArrayFlat( 6 );
iValues = new( ELeave )CDesCArrayFlat( 6 );
// Name
SetFieldL( R_SWCOMMON_DETAIL_NAME, Name() );
// Version
HBufC* stringBuf = CommonUI::CUIUtils::ConstructVersionStringLC( Version().iMajor,
Version().iMinor,
Version().iBuild );
TPtr ptr = stringBuf->Des();
AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
HBufC* tmpBuf = HBufC::NewLC( KLRE().Length() + stringBuf->Length() + KPDF().Length() );
TInt position = stringBuf->Find( KLeftParenthes() );
if ( position >= 0 )
{
tmpBuf->Des() = stringBuf->Mid( 0, position );
tmpBuf->Des() += KLRE();
tmpBuf->Des() += stringBuf->Mid( position, stringBuf->Length() - position );
tmpBuf->Des() += KPDF();
}
else
{
tmpBuf->Des() = *stringBuf;
}
SetFieldL( R_SWCOMMON_DETAIL_VERSION, *tmpBuf );
CleanupStack::PopAndDestroy( tmpBuf );
CleanupStack::PopAndDestroy( stringBuf );
// Supplier
if ( IsTrusted() )
{
SetFieldL( R_SWCOMMON_DETAIL_SUPPLIER, Vendor() );
}
else
{
tmpBuf = StringLoader::LoadLC( R_SWCOMMON_DETAIL_VALUE_UNKNOWN_SUPPLIER );
SetFieldL( R_SWCOMMON_DETAIL_SUPPLIER, *tmpBuf );
CleanupStack::PopAndDestroy( tmpBuf );
}
// size
tmpBuf = StringLoader::LoadLC( R_SWCOMMON_DETAIL_VALUE_UNKNOWN_SIZE );
SetFieldL( R_SWCOMMON_DETAIL_APPSIZE, *tmpBuf );
CleanupStack::PopAndDestroy( tmpBuf );
// Technology
tmpBuf = HBufC::NewLC( KLRE().Length() + KSymbian().Length() + KPDF().Length() );
tmpBuf->Des() = KLRE();
tmpBuf->Des() += KSymbian();
tmpBuf->Des() += KPDF();
SetFieldL( R_SWCOMMON_DETAIL_TECHNOLOGY, *tmpBuf );
CleanupStack::PopAndDestroy( tmpBuf );
// Type
tmpBuf = StringLoader::LoadLC( R_SWCOMMON_DETAIL_VALUE_APPLICATION );
SetFieldL( R_SWCOMMON_DETAIL_TYPE, *tmpBuf );
CleanupStack::PopAndDestroy( tmpBuf );
}
示例6: DoRunL
void CCmdIniEdit::DoRunL()
{
TBool interactive = ETrue;
if (iForce)
{
iReader = CIniReader::NewL(iIniFile);
}
else
{
iReader = CIniFile::NewL(iIniFile, iDescriptionFile);
}
TBool updated = EFalse;
if (iSet)
{
TInt eqPos = iSet->Find(KEquals);
TPtrC value(KNullDesC);
TPtrC id(KNullDesC);
if (eqPos == KErrNotFound)
{
id.Set(*iSet);
Stdin().SetReadModeL(RIoReadHandle::ELine);
iBuf.CreateL(0x100);
Stdin().ReadL(iBuf);
value.Set(iBuf);
}
else
{
id.Set(iSet->Left(eqPos));
value.Set(iSet->Mid(eqPos+1));
}
iReader->SetValueL(Trim(id), value);
updated = ETrue;
interactive = EFalse;
}
if (iRemove)
{
iReader->RemoveValueL(*iRemove);
updated = ETrue;
interactive = EFalse;
}
if (iGet)
{
const TDesC* value = iReader->GetValue(*iGet);
if (!value) LeaveIfErr(KErrNotFound, _L("id '%S' not found in %S"), iGet, &iIniFile);
Write(*value);
interactive = EFalse;
}
else if (iDump)
{
RPointerArray<CValue> values;
CleanupClosePushL(values);
iReader->GetValuesL(values);
for (TInt i=0; i<values.Count(); ++i)
{
if (iForce)
{
Printf(_L("%S: %S\n"), &values[i]->Id(), &values[i]->Value());
}
else
{
CSetting* setting = (CSetting*)values[i];
Printf(_L("%S: %S\n"), &setting->Name(), &setting->Value());
}
}
CleanupStack::PopAndDestroy(&values);
interactive = EFalse;
}
if (interactive)
{
// TODO enter interactive mode
LeaveIfErr(KErrNotSupported, _L("Interactive mode not implemented yet."));
}
if (updated)
{
WriteIniFileL(iIniFile, *iReader);
}
}
示例7: GetKeyRotatorCompensationL
// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::GetKeyRotatorCompensationL
// Parses wsini.ini to read key rotator compensation value.
// -----------------------------------------------------------------------------
//
TInt CAknKeyRotatorImpl::GetKeyRotatorCompensationL()
{
TInt result = 0;
HBufC* wsiniText = GetWsiniLC();
// Now look for keyword
const TInt pos = wsiniText->Find( KAknKeyRotatorKey );
if ( pos != KErrNotFound )
{
// Keyword was found. Check that it is the beginning of line.
// Three cases:
// 1. Keyword could be at the beginning of the file.
// 2. Keyword could be at the beginning of the file
// after byte ordering marker.
// 3. Previous character can be end of line marker.
const TInt previousPos = pos - 1;
if ( previousPos < 0 ||
( !previousPos &&
IsByteOrderingMarker( (*wsiniText)[ previousPos ] ) ) ||
IsEndOfLine( (*wsiniText)[ previousPos ] ) )
{
TLex text( wsiniText->Mid( pos + KAknKeyRotatorKey().Length() ) );
// First, there must be at least a space after keyword.
TBool fail = !( SkipSpaces( text ) & EAknWasSpace );
// Case 1: Disabled
TBool wasDisabled = EFalse;
if ( !fail )
{
wasDisabled =
!text.Remainder().Left( KAknKeyRotatorDisabled().Length() ).
CompareF( KAknKeyRotatorDisabled );
if ( wasDisabled )
{
// wasDisabled == True, KAknKeyRotatorDisabled was prefix
// of text. So skip over it
text.Inc( KAknKeyRotatorDisabled().Length() );
}
}
// Case 2: Then follows a sequence of digits, optionally preceded by '-'.
if ( !wasDisabled && !fail )
{
// Check optional -
TBool negate = EFalse;
if ( !text.Eos() && text.Peek() == '-' )
{
negate = ETrue;
text.Inc();
}
// Get digit sequence and convert to integer value.
TPtrC token = GetDigits( text );
fail = !token.Length() ||
( TLex( token ).Val( result ) != KErrNone );
// Handle negation
if ( !fail && negate )
{
result = -result;
}
}
// That sequence of digits is followed by sequence of spaces until
// end of line or end of file.
fail = fail || ( SkipSpaces( text ) & EAknWasCharacter );
if ( !wasDisabled )
{
// Finally, that sequence of digits must represent
// one valid decimal value of the following:
// -270, -180, -90, 0, 90, 180, 270.
fail = fail || !CheckCompensationValue( result );
}
// If any of above checks failed, use default value 0.
if ( fail )
{
result = 0;
}
else
{
if ( wasDisabled )
{
result = KMaxTInt;
}
}
}
}
CleanupStack::PopAndDestroy( wsiniText );
return result;
}