diff -r 000000000000 -r ba25891c3a9e installationservices/swi/inc/uissstream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/installationservices/swi/inc/uissstream.h Thu Dec 17 08:51:10 2009 +0200 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* uisupportstream.h +* Definition of the streaming functions used by the UI Support Server +* to internalise and exernalize arrays into and from a descriptor +* +*/ + + +/** + @file + @internalComponent + @released +*/ + +#ifndef __UISUPPORTSTREAM_H__ +#define __UISUPPORTSTREAM_H__ + +#include +#include "msisuihandlers.h" + +class RReadStream; +class RWriteStream; + +namespace Swi +{ +/** + * Serialize an array of TDesC objects to a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamOutArrayL(const RPointerArray& aArray, RWriteStream& aStream); + +/** + * Serialize an array of TDesC objects from a stream. + * + * @param aArray The array to stream into. + * @param aStream The stream to read the contents of the array from. + */ +IMPORT_C void StreamInArrayL(RPointerArray& aArray, RReadStream& aStream); + +/** + * Serialize an array of CCertificateInfo objects to a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamOutArrayL(const RPointerArray& aArray, RWriteStream& aStream); + +/** + * Serialize an array of CPKIXValidationResultBase objects from a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamInArrayL( + RPointerArray& aArray, + RReadStream& aStream); + +/** + * Serialize an array of CPKIXValidationResultBase objects to a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamOutArrayL( + const RPointerArray& aArray, + RWriteStream& aStream); + +/** + * Serialize an array of TOCSPOutcome objects from a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamInArrayL(RPointerArray& aArray, + RReadStream& aStream); + +/** + * Serialize an array of TOCSPOutcome objects to a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamOutArrayL(const RPointerArray& aArray, + RWriteStream& aStream); + +/** + * Serialize an array of CCertificateInfo objects from a stream. + * + * @param aArray The array to stream out. + * @param aStream The stream to write the contents of the array to. + */ +IMPORT_C void StreamInArrayL(RPointerArray& aArray, RReadStream& aStream); + +/* + * The following functions and classes allow the streaming of arrays of objects. + * These functions work by streaming out the memory of the class directly, so they + * will only work with T-type classes. In order to restrict the matching of the template + * arguments, helpers have been added. In order to allow another type, add a + * TClassAllowable<> specialization of that type with the Allow enum equal to ETrue. + */ + +template +void StreamOutArrayL(const RArray& aArray, RWriteStream& aStream); + +template +void StreamInArrayL(RArray& aArray, RReadStream& aStream); + +namespace StreamHelpers + { + // Default to not allowing the streaming + template + struct TClassAllowable + { + enum {Allow = EFalse}; + }; + + // Add allowed types here; any PODs (TTypes) are safe + template <> struct TClassAllowable { enum {Allow = ETrue}; }; + template <> struct TClassAllowable { enum {Allow = ETrue}; }; + template <> struct TClassAllowable { enum {Allow = ETrue}; }; + template <> struct TClassAllowable { enum {Allow = ETrue}; }; + template <> struct TClassAllowable { enum {Allow = ETrue}; }; + + // The default StreamArrayHelper does not allow streaming + template + struct StreamArrayHelper + { + }; + + // partially specialized version to do streaming + template + struct StreamArrayHelper + { + static void StreamOutArrayL(const RArray& aArray, RWriteStream& aStream); + static void StreamInArrayL(RArray& aArray, RReadStream& aStream); + }; + } // namespace StreamHelpers + +#include "uissstream.inl" + +} // namespace Swi + +#endif // #ifndef __UISUPPORTSTREAM_H__