installationservices/swi/source/sishelper/sishelperstream.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "sishelperstream.h"
       
    27 
       
    28 
       
    29 namespace Swi
       
    30 {
       
    31 
       
    32 const TInt CSisHelperStream::KBufferSize=50;
       
    33 
       
    34 CSisHelperStream* CSisHelperStream::NewL()
       
    35 	{
       
    36 	CSisHelperStream* self=CSisHelperStream::NewLC();
       
    37 	CleanupStack::Pop(self);
       
    38 	return self;
       
    39 	}
       
    40 
       
    41 CSisHelperStream* CSisHelperStream::NewLC()
       
    42 	{
       
    43 	CSisHelperStream* self=new(ELeave) CSisHelperStream();
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL();
       
    46 	return self;	
       
    47 	}
       
    48 		
       
    49 CSisHelperStream::~CSisHelperStream()
       
    50 	{
       
    51 	if (iWriteStream)
       
    52 		{
       
    53 		iWriteStream->Close();
       
    54 		delete iWriteStream;
       
    55 		}
       
    56 	delete iBuffer;
       
    57 	}
       
    58 
       
    59 CSisHelperStream::CSisHelperStream()
       
    60 	{
       
    61 	}
       
    62 
       
    63 void CSisHelperStream::ConstructL()
       
    64 	{
       
    65 	iBuffer = CBufFlat::NewL(KBufferSize);
       
    66 	iWriteStream = new RBufWriteStream(*iBuffer);
       
    67 	}
       
    68 
       
    69 CSisHelperStream::operator RBufWriteStream&()
       
    70 	{
       
    71 	return *iWriteStream;
       
    72 	}
       
    73 
       
    74 TPtr8 CSisHelperStream::Ptr()
       
    75 	{
       
    76 	return iBuffer->Ptr(0);
       
    77 	}
       
    78 	
       
    79 } // namespace Swi