epoc32/include/obexinternalutils.h
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // $Workfile: obexinternalutils.h $
       
    15 // $Author: Stevep $
       
    16 // $Revision: 1 $
       
    17 // $Date: 12/11/01 11:36 $
       
    18 // 
       
    19 //
       
    20 
       
    21 #ifndef __OBEXINTERNALUTILS_H
       
    22 #define __OBEXINTERNALUTILS_H
       
    23 
       
    24 #include <e32base.h>
       
    25 class RReadStream;
       
    26 class RWriteStream;
       
    27 
       
    28 class ObexInternalUtils : public CBase
       
    29 /**
       
    30 Utility class containing on static member functions to provide internalize/externalize functionality to
       
    31 HBufC and HBufC8.
       
    32 
       
    33 @internalTechnology
       
    34 @released
       
    35 */
       
    36 	{
       
    37 public:
       
    38 	///Enumeration for panic codes
       
    39 	enum TObexInternalUtilsPanic
       
    40 		{
       
    41 		EObexBadStreamVersion ///< Panic if stream version is incorrect
       
    42 		};
       
    43 public:
       
    44 	
       
    45 	/**
       
    46 	 * Externalizes a HBufC to a stream.
       
    47 	 *
       
    48 	 * @param aBuf The HBufC to be externalized
       
    49 	 * @param aStream The stream to be written to
       
    50 	 * @leave KErrXXX Leaves with standard EPOC stream leave codes
       
    51 	 */
       
    52 	
       
    53 	IMPORT_C static void ExternalizeL(const HBufC* aBuf, RWriteStream& aStream);
       
    54 
       
    55 	/**
       
    56 	 * Internalizes a HBufC from a stream.
       
    57 	 *
       
    58 	 * @param aBuf The HBufC to be internalized
       
    59 	 * @param aStream The stream to be read from
       
    60 	 * @leave KErrXXX Leaves with standard EPOC stream and memory allocation leave codes
       
    61 	 */
       
    62 
       
    63 	IMPORT_C static void InternalizeL(HBufC*& aBuf, RReadStream& aStream);
       
    64 
       
    65 	/**
       
    66 	 * Externalizes a HBufC8 to a stream.
       
    67 	 *
       
    68 	 * @param aBuf The HBufC8 to be externalized
       
    69 	 * @param aStream The stream to be written to
       
    70 	 * @leave KErrXXX Leaves with standard EPOC stream leave codes
       
    71 	 */
       
    72 	
       
    73 	IMPORT_C static void ExternalizeL(const HBufC8* aBuf, RWriteStream& aStream);
       
    74 	
       
    75 	/**
       
    76 	 * Internalizes a HBufC8 from a stream.
       
    77 	 *
       
    78 	 * @param aBuf The HBufC8 to be internalized
       
    79 	 * @param aStream The stream to be read from
       
    80 	 * @leave KErrXXX Leaves with standard EPOC stream and memory allocation leave codes
       
    81 	 */ 
       
    82 	
       
    83 	IMPORT_C static void InternalizeL(HBufC8*& aBuf, RReadStream& aStream);
       
    84 
       
    85 	/**
       
    86 	 * Externalizes a TDes to a stream.
       
    87 	 *
       
    88 	 * @param aBuf The TDes to be externalized
       
    89 	 * @param aStream The stream to be written to
       
    90 	 * @leave KErrXXX Leaves with standard EPOC stream leave codes
       
    91 	 */
       
    92 	
       
    93 	IMPORT_C static void ExternalizeL(const TDes& aBuf, RWriteStream& aStream);
       
    94 	
       
    95 	/**
       
    96 	 * Internalizes a TDes from a stream.
       
    97 	 *
       
    98 	 * @param aDes The TDes to be internalized
       
    99 	 * @param aStream The stream to be read from
       
   100 	 * @leave KErrXXX Leaves with standard EPOC stream and memory allocation leave codes
       
   101 	 * @leave KErrOverflow if the incoming data is too big for the TBuf provided
       
   102 	 */
       
   103 	
       
   104 	IMPORT_C static void InternalizeL(TDes& aBuf, RReadStream& aStream);
       
   105 
       
   106 	/**
       
   107 	 * Externalizes a TDes8 to a stream.
       
   108 	 *
       
   109 	 * @param aBuf The TDes8 to be externalized
       
   110 	 * @param aStream The stream to be written to
       
   111 	 * @leave KErrXXX Leaves with standard EPOC stream leave codes
       
   112 	 */
       
   113 
       
   114 	IMPORT_C static void ExternalizeL(const TDes8& aBuf, RWriteStream& aStream);
       
   115 	
       
   116 	/**
       
   117 	 * Internalizes a TDes8 from a stream.
       
   118 	 *
       
   119 	 * @param aBuf The TDes8 to be internalized
       
   120 	 * @param aStream The stream to be read from
       
   121 	 * @leave KErrXXX Leaves with standard EPOC stream and memory allocation leave codes
       
   122 	 * @leave KErrOverflow if the incoming data is too big for the TBuf provided
       
   123 	 */
       
   124 	
       
   125 	IMPORT_C static void InternalizeL(TDes8& aBuf, RReadStream& aStream);
       
   126 
       
   127 	/**
       
   128 	 * Indicates Panic originates from Obex MTM
       
   129 	 *
       
   130 	 * @param aPanic The type of TObexInternalUtilsPanic which has taken place
       
   131 	 */
       
   132 
       
   133 	IMPORT_C static void Panic(TObexInternalUtilsPanic aPanic);
       
   134 	};
       
   135 
       
   136 #endif//__OBEXINTERNALUTILS_H