/** Sets the start and end points of the read and/or the write area within the intermediate buffer. A start point is always within an area; an end point is always the first byte beyond the end of an area. @param anArea The areas within the intermediate buffer for which the start and end points are to be set. These can be the read area and/or the write area, as indicated by the ERead and EWrite bits. Only these bits can be set, otherwise the function raises a STORE-Stream 17 panic. @param aPtr The start point. @param anEnd The end point. @see MStreamBuf::TRead @see MStreamBuf::TWrite */ EXPORT_C void TStreamBuf::SetBuf(TArea anArea,TUint8* aPtr,TUint8* anEnd) { __ASSERT_ALWAYS(!(anArea&~(ERead|EWrite)),Panic(EStreamAreaInvalid)); if (anArea&ERead) SetBuf(ERead,aPtr,anEnd); if (anArea&EWrite) SetBuf(EWrite,aPtr,anEnd); }
// --------------------------------------------------------- // RFavouritesBuf::IpcReadL() // --------------------------------------------------------- // TInt RFavouritesBuf::IpcReadL() { TPtr8 des( iBuf.iData, KFavouritesStreamBufSize ); TInt len = User::LeaveIfError ( SendReceive( EFavengStreamRead, TIpcArgs( &des ) ) ); SetBuf( EWrite, iBuf.iData, iBuf.iData ); SetBuf( ERead, iBuf.iData, iBuf.iData + len ); return len; }
// --------------------------------------------------------- // RFavouritesBuf::IpcWriteL() // --------------------------------------------------------- // void RFavouritesBuf::IpcWriteL() { if ( Lag( EWrite ) ) { TPtrC8 ptr( iBuf.iData, Lag( EWrite ) ); User::LeaveIfError ( SendReceive( EFavengStreamWrite, TIpcArgs( &ptr ) ) ); } SetBuf( ERead, iBuf.iData, iBuf.iData ); SetBuf( EWrite, iBuf.iData, iBuf.iData + KFavouritesStreamBufSize ); }
EXPORT_C void TDesBuf::Set(TDes8& aDes,TInt aMode) /** Sets up the stream to use the specified descriptor. @param aDes The descriptor that hosts the stream and that also acts as the intermediate buffer. @param aMode The mode in which the buffer is to be used. It can be used in either or both read and write modes, represented by ERead and EWrite. @see TDes8 @see MStreamBuf::TRead @see MStreamBuf::TWrite */ { iDes=&aDes; TUint8* ptr=(TUint8*)aDes.Ptr(); SetBuf(ERead,(aMode&ERead)?ptr:NULL,ptr+aDes.Length()); SetBuf(EWrite,(aMode&EWrite)?ptr:NULL,ptr+aDes.MaxLength()); }
void TBL_CYCLE_FEE_EVENT_CLASS::AddItem(void) { if (a_item==NULL) SetBuf(); a_item[iCurPos++]=item; if (iCurPos==iBufferSize ) SaveFlush(); }
void TBL_STAFF_CLASS::AddItem(void) { if (a_item==NULL) SetBuf(); a_item[iCurPos++]=item; if (iCurPos==iBufferSize ) SaveFlush(); }
EXPORT_C void TMemBuf::Set(TUint8* aPtr,TUint8* anEnd,TInt aMode) /** Sets up the stream to use the specified area of plain memory. @param aPtr The start address for the area of plain memory that hosts the stream and that also acts as the intermediate buffer. @param anEnd The end address for the area of plain memory that hosts the stream and that also acts as the intermediate buffer. The addressed byte is outside the memory area. @param aMode The mode in which the stream is to be used. It can be used in either or both read and write modes, represented by ERead and EWrite. @see MStreamBuf::TRead @see MStreamBuf::TWrite */ { if (aPtr==NULL && anEnd==NULL) aPtr=anEnd=(TUint8*)this; // treat null data as seekable zero-length data iBase=aPtr; SetBuf(ERead,(aMode&ERead)?aPtr:NULL,anEnd); SetBuf(EWrite,(aMode&EWrite)?aPtr:NULL,anEnd); }
// --------------------------------------------------------- // RFavouritesBuf::DoSynchL() // --------------------------------------------------------- // void RFavouritesBuf::DoSynchL() { if ( Lag( ERead ) ) { // Read lag unexpected, we do not support seeking. User::Leave( KErrNotSupported ); } IpcWriteL(); // Flush write lag. SetBuf( ERead | EWrite, iBuf.iData, iBuf.iData ); }
void TBufBuf::Consolidate() // // Empty buffer areas and, in truncate mode, cut off at the current write position. // { MovePos(ERead,-Avail(ERead)); MovePos(EWrite,-Avail(EWrite)); SetBuf(ERead|EWrite,NULL,NULL); if (iMode&ETruncate) { Buf().Delete(Pos(EWrite),Buf().Size()-Pos(EWrite)); iMode&=~ETruncate; } }
EXPORT_C void TBufBuf::OverflowL() // // Establish the buffer's write area. // { __ASSERT_ALWAYS(iMode&EWrite,Panic(EMemCannotWrite)); __ASSERT_DEBUG(Ptr(EWrite)==End(EWrite)&&Pos(EWrite)<Buf().Size(),User::Invariant()); TInt pos=Pos(EWrite); TPtr8 seg=Buf().Ptr(pos); TUint8* ptr=(TUint8*)seg.Ptr(); TInt len=seg.Length(); SetBuf(EWrite,ptr,ptr+len); SetPos(EWrite,pos+len); }
Chat::Chat (String b) : chatmanager_ (new ChatManager ()) , chatcommand_ (new ChatCommand ()) , offset_ (0) , index_ (0) , chan_ (0) , entry_ ("") , output_ ("") , buffer_ () , history_ (*(new BufferType ())) , isCommand_ (false) { SetBuf (b); }
// --------------------------------------------------------- // RFavouritesBuf::Open // --------------------------------------------------------- // TInt RFavouritesBuf::Open ( RFavouritesHandle& aHandle, TInt aFunction, TIpcArgs& aArgs ) { iBuf.iLen = 0; SetBuf( ERead | EWrite, iBuf.iData, iBuf.iData ); // Initially empty. TPckg<TFavouritesBuf> buf( iBuf ); aArgs.Set( 3, &buf ); TInt err = RFavouritesHandle::Open( aHandle, aFunction, aArgs ); if ( !err && iBuf.iLen > 0 ) { // If aFunction provided data, it is already here. SetEnd( ERead, iBuf.iData + iBuf.iLen ); } return err; }
EXPORT_C TInt TBufBuf::UnderflowL(TInt) // // Establish the buffer's read area. // { __ASSERT_ALWAYS(iMode&ERead,Panic(EMemCannotRead)); __ASSERT_DEBUG(Ptr(ERead)==End(ERead),User::Invariant()); TInt pos=Pos(ERead); TPtr8 seg=Buf().Ptr(pos); TUint8* ptr=(TUint8*)seg.Ptr(); TInt len=seg.Length(); if (iMode&ETruncate) { TInt left=Pos(EWrite)-pos; __ASSERT_DEBUG(left>=0,User::Invariant()); if (left<len) len=left; } SetBuf(ERead,ptr,ptr+len); SetPos(ERead,pos+len); return len; }
bool FolderBrowserDialog::SetDescription(const wchar_t * str) { return SetBuf(str, Descr, BUFLEN); }
// --------------------------------------------------------- // RFavouritesBuf::Open // --------------------------------------------------------- // TInt RFavouritesBuf::Open( RFavouritesSession& aSess ) { SetBuf( ERead | EWrite, iBuf.iData, iBuf.iData ); // Empty. return RFavouritesHandle::Open( aSess, EFavengOpenStream, TIpcArgs() ); }
bool FolderBrowserDialog::SetTitle(const wchar_t * str) { return SetBuf(str, Title, BUFLEN); }
//-------------------------------------------------------------------- // Function: OnActivateDialog // // Description: // // Input: hwnd - // // Modifies: // // Returns: // //-------------------------------------------------------------------- static void OnActivateDialog(HWND hwnd) { int i; TCHAR szBuffer[64], szFormat[32]; WORD wLevel; HWND hwndChild; for (i = 0; i < MEDIA_TRAY_MAX_NUMBER; i++) { if (media_tray[i].bInstalled IS TRUE) { loadMediaType(hwnd, IDC_MEDIA_TYPE1 + i, media_tray[i].uMediaTypeID); } else { if (hwndChild = GetDlgItem(hwnd, IDC_MEDIA_TYPE1 + i)) ShowWindow(hwndChild, SW_HIDE); if (hwndChild = GetDlgItem(hwnd, IDC_TRAY1_NAME + i)) ShowWindow(hwndChild, SW_HIDE); } } LoadString(hInstance, IDS_PERCENT, szFormat, SIZEOF_IN_CHAR(szFormat)); if (hwndChild = GetDlgItem(hwnd, IDC_MEDIA_STATUS1)) { SetBuf( szBuffer, sizeof(szBuffer), szFormat, (signed short) media_tray[0].uLevel, &wLevel); SetWindowWord(hwndChild, GWW_TRAYLEVEL, wLevel); SetWindowText(hwndChild, szBuffer); } if (hwndChild = GetDlgItem(hwnd, IDC_MEDIA_STATUS2)) { SetBuf( szBuffer, sizeof(szBuffer), szFormat, (signed short) media_tray[1].uLevel, &wLevel); SetWindowWord(hwndChild, GWW_TRAYLEVEL, wLevel); SetWindowText(hwndChild, szBuffer); } if (hwndChild = GetDlgItem(hwnd, IDC_MEDIA_STATUS3)) { SetBuf( szBuffer, sizeof(szBuffer), szFormat, (signed short) media_tray[2].uLevel, &wLevel); SetWindowWord(hwndChild, GWW_TRAYLEVEL, wLevel); SetWindowText(hwndChild, szBuffer); } if (hwndChild = GetDlgItem(hwnd, IDC_MEDIA_STATUS4)) { if (media_tray[3].bInstalled IS TRUE) { SetBuf( szBuffer, sizeof(szBuffer), szFormat, (signed short) media_tray[3].uLevel, &wLevel); SetWindowWord(hwndChild, GWW_TRAYLEVEL, wLevel); SetWindowText(hwndChild, szBuffer); } else ShowWindow(hwndChild, SW_HIDE); } if (hwndChild = GetDlgItem(hwnd, IDC_MEDIA_STATUS5)) { if (media_tray[4].bInstalled IS TRUE) { SetBuf( szBuffer, sizeof(szBuffer), szFormat, (signed short) media_tray[4].uLevel, &wLevel); SetWindowWord(hwndChild, GWW_TRAYLEVEL, wLevel); SetWindowText(hwndChild, szBuffer); } else ShowWindow (hwndChild, SW_HIDE); } }