// ----------------------------------------------------------------------------- // CContactSubscriber::RunL() // Assyncronous request handler , on completion of notification // ----------------------------------------------------------------------------- // void CContactSubscriber::RunL() { __TRACE_CALLSTACK; SubscribeChangeNotiFication(); // property updated, get new value TBuf8 <KBufferSize> value; TPtrC8 id; TPtrC8 sourceType; TPtrC8 addressCount; if ( KErrNone == iProperty.Get( value ) ) { TInt pos = value.Locate(TChar('-')); id.Set( value.Left(pos) ); TPtrC8 ptr = value.Right(3); sourceType.Set(ptr.Left(1)); addressCount.Set(ptr.Right(1)); TInt appId = -1, addressType = -1, addressTypeCount = -1; TLex8 lex(id); lex.Val(appId); TLex8 lex1(sourceType); lex1.Val( addressType ); TLex8 lex2(addressCount); lex2.Val(addressTypeCount); iNotifyChange.GetChangeNotificationL( appId, addressType,addressTypeCount ); } }
void CLinePaginatorTest::OpenTestFileL() { TBuf8<128> text; TInt err=ifsClient.Connect(); err=iTestFile.Open(ifsClient,TEST_FILE,EFileStream|EFileRead|EFileShareReadersOnly); iTestFile.Read(0,text,128); TInt startNum=text.Locate('<')+1; text.Delete(0,startNum); TLex8 lex=text; TInt pageHeight; lex.Val(pageHeight); iPaginator.SetPageHeight(pageHeight); TBuf<254> buf; buf.AppendFormat(_L("DocPos\tHeight\tKeep\tStart\tHeight of Pages = <%d>\n"), pageHeight); TESTPRINT(buf); }
/** ConstructL() Parses a .txt file and creates Arrays of fields and there values @param aFileName Name of the file to be parsed. */ EXPORT_C void CT_MsgUtilsConfigFileParserUtility::ConstructL(const TDesC& aFileName) { RFs fileServerSession; fileServerSession.Connect(); RFile file; User::LeaveIfError(file.Open(fileServerSession, aFileName, EFileRead)); TInt eof = EFalse; TInt fileOffset = 0; TBuf8<KFileBufferSize> fileBuffer; while (!eof) { fileBuffer.SetLength(0); User::LeaveIfError(file.Read(fileOffset, fileBuffer, KFileBufferSize)); TInt read = fileBuffer.Length(); if (read < KFileBufferSize) { fileBuffer.Append('\n'); eof = ETrue; } TInt lineOverflow = fileBuffer.Locate('\n'); if ((lineOverflow == KErrNotFound) && (read == KFileBufferSize)) { User::Leave(KErrOverflow); } TInt eol = EFalse; while (!eol) { TInt lineFeedLocation = fileBuffer.Locate('\n'); if (lineFeedLocation == KErrNotFound) { eol = ETrue; } else { fileOffset += lineFeedLocation + 1; TInt lineLength; if ((lineFeedLocation != 0) && (fileBuffer[lineFeedLocation - 1] == '\r')) { lineLength = lineFeedLocation - 1; } else { lineLength = lineFeedLocation; } TPtrC8 line = fileBuffer.Left(lineLength); TInt commentLocation = line.Match(KComment); if (commentLocation != KErrNotFound) { TPtrC8 skipComment = line.Left(commentLocation); line.Set(skipComment); } TInt seperatorLocation = line.Locate('='); if (seperatorLocation != KErrNotFound) { if ((seperatorLocation == 0) || (seperatorLocation == line.Length() - 1)) { seperatorLocation = KErrNotFound; } } if (seperatorLocation != KErrNotFound) { TPtrC8 namePtr = line.Left(seperatorLocation); HBufC8* nameBuf8 = HBufC8::NewL(namePtr.Length()); CleanupStack::PushL(nameBuf8); TPtr8 name8 = nameBuf8->Des(); name8.Copy(namePtr); name8.Trim(); HBufC* nameBuf16 = HBufC::NewL(namePtr.Length()); TPtr name16 = nameBuf16->Des(); name16.Copy(name8); iName.Append(nameBuf16); CleanupStack::PopAndDestroy(nameBuf8); TPtrC8 contentPtr = line.Mid(seperatorLocation + 1); HBufC8* contentBuf8 = HBufC8::NewL(contentPtr.Length()); CleanupStack::PushL(contentBuf8); TPtr8 content8 = contentBuf8->Des(); content8.Copy(contentPtr); content8.Trim(); HBufC* contentBuf16 = HBufC::NewL(contentPtr.Length()); TPtr content16 = contentBuf16->Des(); content16.Copy(content8); iContent.Append(contentBuf16); iContent8.Append(contentBuf8); CleanupStack::Pop(contentBuf8); } TPtrC8 theRest = fileBuffer.Mid(lineFeedLocation + 1); fileBuffer.Copy(theRest); } } } file.Close(); fileServerSession.Close(); }
TBool CLinePaginatorTest::ReadTestFile(TPageLine& aLine) { TLex8 lex; TBuf8<128> textBuffer; TBuf8<128> numBuffer; TInt startNum; iTestFile.Read(iFilePos,textBuffer,128); if (textBuffer.Locate('X') != KErrNotFound && textBuffer.Locate('X') < textBuffer.Locate('\r')) { startNum=textBuffer.Locate('\n')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iDocPos); TBuf<254> buf; buf.AppendFormat(_L("%d\tX\n"), aLine.iDocPos); TESTPRINT(buf); return EFalse; } startNum=textBuffer.Locate('\n')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iDocPos); startNum=textBuffer.Locate('\t')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iLineHeight); startNum=textBuffer.Locate('\t')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iKeepWithNext); startNum=textBuffer.Locate('\t')+1; textBuffer.Delete(0,startNum); iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iStartNewPage); if (textBuffer.Locate('\t')<textBuffer.Locate('\r') && textBuffer.Locate('B')!=KErrNotFound && textBuffer.Locate('B')<textBuffer.Locate('\r')) iTestPageBreak=ETrue; else iTestPageBreak=EFalse; iFilePos+=textBuffer.Locate('\r')+1; return ETrue; }