installationservices/swi/inc/uissstream.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 * uisupportstream.h
       
    16 * Definition of the streaming functions used by the UI Support Server
       
    17 * to internalise and exernalize arrays into and from a descriptor
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @internalComponent
       
    25  @released
       
    26 */
       
    27  
       
    28 #ifndef __UISUPPORTSTREAM_H__
       
    29 #define __UISUPPORTSTREAM_H__
       
    30 
       
    31 #include <e32std.h>
       
    32 #include "msisuihandlers.h"
       
    33 
       
    34 class RReadStream;
       
    35 class RWriteStream;
       
    36 
       
    37 namespace Swi
       
    38 {
       
    39 /**
       
    40  * Serialize an array of TDesC objects to a stream.
       
    41  *
       
    42  * @param aArray	The array to stream out.
       
    43  * @param aStream	The stream to write the contents of the array to.
       
    44  */
       
    45 IMPORT_C void StreamOutArrayL(const RPointerArray<TDesC>& aArray, RWriteStream& aStream);
       
    46 
       
    47 /**
       
    48  * Serialize an array of TDesC objects from a stream.
       
    49  *
       
    50  * @param aArray	The array to stream into.
       
    51  * @param aStream	The stream to read the contents of the array from.
       
    52  */
       
    53 IMPORT_C void StreamInArrayL(RPointerArray<TDesC>& aArray, RReadStream& aStream);
       
    54 
       
    55 /**
       
    56  * Serialize an array of CCertificateInfo objects to a stream.
       
    57  *
       
    58  * @param aArray	The array to stream out.
       
    59  * @param aStream	The stream to write the contents of the array to.
       
    60  */
       
    61 IMPORT_C void StreamOutArrayL(const RPointerArray<CCertificateInfo>& aArray, RWriteStream& aStream);
       
    62 
       
    63 /**
       
    64  * Serialize an array of CPKIXValidationResultBase objects from a stream.
       
    65  *
       
    66  * @param aArray	The array to stream out.
       
    67  * @param aStream	The stream to write the contents of the array to.
       
    68  */
       
    69 IMPORT_C void StreamInArrayL(
       
    70 	RPointerArray<CPKIXValidationResultBase>& aArray, 
       
    71 	RReadStream& aStream);
       
    72 
       
    73 /**
       
    74  * Serialize an array of CPKIXValidationResultBase objects to a stream.
       
    75  *
       
    76  * @param aArray	The array to stream out.
       
    77  * @param aStream	The stream to write the contents of the array to.
       
    78  */
       
    79 IMPORT_C void StreamOutArrayL(
       
    80 	const RPointerArray<CPKIXValidationResultBase>& aArray, 
       
    81 	RWriteStream& aStream);
       
    82 
       
    83 /**
       
    84  * Serialize an array of TOCSPOutcome objects from a stream.
       
    85  *
       
    86  * @param aArray	The array to stream out.
       
    87  * @param aStream	The stream to write the contents of the array to.
       
    88  */
       
    89 IMPORT_C void StreamInArrayL(RPointerArray<TOCSPOutcome>& aArray,
       
    90 	RReadStream& aStream);
       
    91 
       
    92 /**
       
    93  * Serialize an array of TOCSPOutcome objects to a stream.
       
    94  *
       
    95  * @param aArray	The array to stream out.
       
    96  * @param aStream	The stream to write the contents of the array to.
       
    97  */
       
    98 IMPORT_C void StreamOutArrayL(const RPointerArray<TOCSPOutcome>& aArray, 
       
    99 	RWriteStream& aStream);
       
   100 
       
   101 /**
       
   102  * Serialize an array of CCertificateInfo objects from a stream.
       
   103  *
       
   104  * @param aArray	The array to stream out.
       
   105  * @param aStream	The stream to write the contents of the array to.
       
   106  */
       
   107 IMPORT_C void StreamInArrayL(RPointerArray<CCertificateInfo>& aArray, RReadStream& aStream);
       
   108 
       
   109 /*
       
   110  * The following functions and classes allow the streaming of arrays of objects. 
       
   111  * These functions work by streaming out the memory of the class directly, so they
       
   112  * will only work with T-type classes. In order to restrict the matching of the template
       
   113  * arguments, helpers have been added. In order to allow another type, add a 
       
   114  * TClassAllowable<> specialization of that type with the Allow enum equal to ETrue.
       
   115  */
       
   116 
       
   117 template <class T>
       
   118 void StreamOutArrayL(const RArray<T>& aArray, RWriteStream& aStream);
       
   119 
       
   120 template <class T>
       
   121 void StreamInArrayL(RArray<T>& aArray, RReadStream& aStream);
       
   122 
       
   123 namespace StreamHelpers
       
   124 	{
       
   125 	// Default to not allowing the streaming
       
   126 	template <class T>
       
   127 	struct TClassAllowable
       
   128 		{
       
   129 		enum  {Allow = EFalse};
       
   130 		};
       
   131 
       
   132 	// Add allowed types here; any PODs (TTypes) are safe
       
   133 	template <> struct TClassAllowable<TInt> { enum {Allow = ETrue}; };
       
   134 	template <> struct TClassAllowable<TLanguage> { enum {Allow = ETrue}; };
       
   135 	template <> struct TClassAllowable<TInt64> { enum {Allow = ETrue}; };
       
   136 	template <> struct TClassAllowable<TChar> { enum {Allow = ETrue}; };
       
   137 	template <> struct TClassAllowable<TDesC16> { enum {Allow = ETrue}; };
       
   138 
       
   139 	// The default StreamArrayHelper does not allow streaming
       
   140 	template <class T, TBool>
       
   141 	struct StreamArrayHelper
       
   142 		{
       
   143 		};
       
   144 
       
   145 	// partially specialized version to do streaming
       
   146 	template <class T>
       
   147 	struct StreamArrayHelper<T, ETrue>
       
   148 		{
       
   149 		static void StreamOutArrayL(const RArray<T>& aArray, RWriteStream& aStream);
       
   150 		static void StreamInArrayL(RArray<T>& aArray, RReadStream& aStream);
       
   151 		};
       
   152 	} // namespace StreamHelpers
       
   153 
       
   154 #include "uissstream.inl"
       
   155 
       
   156 } // namespace Swi
       
   157 
       
   158 #endif // #ifndef __UISUPPORTSTREAM_H__