sl@0: /* sl@0: * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __NullStream_h__ sl@0: #define __NullStream_h__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: * Implementation of the MStreamBuf interface that throws away all data written sl@0: * to it. It does not support reading. sl@0: */ sl@0: sl@0: class TNullBuf : public MStreamBuf sl@0: { sl@0: public: sl@0: TNullBuf(); sl@0: TUint BytesWritten(); sl@0: private: sl@0: virtual void DoWriteL(const TAny* aPtr,TInt aLength); sl@0: private: sl@0: TUint iBytesWritten; sl@0: }; sl@0: sl@0: /** sl@0: * A write stream that throws away all its input, but keeps track of how many sl@0: * bytes have been written to it. It is used for determining the amount of sl@0: * memory needed to store externalised objects. sl@0: */ sl@0: sl@0: class RNullWriteStream : public RWriteStream sl@0: { sl@0: public: sl@0: RNullWriteStream(); sl@0: TUint BytesWritten(); sl@0: private: sl@0: TNullBuf iSink; sl@0: }; sl@0: sl@0: #endif