genericopenlibs/cstdlib/RedirCli/STREAM.CPP
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32std.h>
       
    17 #include <redirstr.h>
       
    18 #include <redircli.h>
       
    19 //
       
    20 // -------------- Stream implementation ------------------------
       
    21 //
       
    22 EXPORT_C void CStreamBase2::CompleteRead(const RMessage2 &aMessage) 
       
    23 	{
       
    24 	// retrieve the max length of the buffer the client has allocated
       
    25 	TInt length = aMessage.Int1();
       
    26 	// create a local buffer for placing characters to be written to
       
    27 	// client. This is a copy of the the iBuf internal buffer of the stream
       
    28 	TBuf8<256> buf(iBuf);
       
    29 
       
    30 	if (length < buf.Length() ) 
       
    31 		{
       
    32 		// then we can't copy all the buffer to the client so we have reduce
       
    33 		// the buffers length
       
    34 		buf.SetLength(length);
       
    35 		// delete appropriate part of stream's internal buffer
       
    36 		iBuf.Delete(0,length);
       
    37 		} 
       
    38 	else 
       
    39 		{
       
    40 		// we can copy all of the buffer to the client so we set the streams
       
    41 		// descriptor to zero length
       
    42 		iBuf.Zero();
       
    43 		}
       
    44 	// copy the local descriptor to the client.
       
    45 	TRAPD(ret,aMessage.WriteL(0, buf));
       
    46 	// inform the client of success/failure by completing the message
       
    47 	aMessage.Complete(ret);
       
    48 	return;
       
    49 	}
       
    50 
       
    51 EXPORT_C void CStreamFactoryBase2::AppendToStatus(const TDesC& aMsg) { iStatusMsg.Append(aMsg); }
       
    52 
       
    53 EXPORT_C const TDesC& CStreamFactoryBase2::GetStatus() const { return iStatusMsg; }
       
    54 
       
    55 // Dummy functions to replace previous exports so def file does not need reordering.
       
    56 EXPORT_C void DummyReserved1() {};
       
    57 EXPORT_C void DummyReserved2() {};
       
    58 EXPORT_C void DummyReserved3() {};
       
    59 EXPORT_C void DummyReserved4() {};
       
    60 EXPORT_C void DummyReserved5() {};
       
    61 EXPORT_C void DummyReserved6() {};
       
    62 EXPORT_C void DummyReserved7() {};
       
    63 EXPORT_C void DummyReserved8() {};
       
    64 EXPORT_C void DummyReserved9() {};
       
    65 EXPORT_C void DummyReserved10() {};
       
    66 EXPORT_C void DummyReserved11() {};