wvsettings20/IMPSSrc/IMPSSAPObjectHandler.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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 "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:  Object handler implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __IMPSSAPOBJECTHANDLER_H
       
    19 #define __IMPSSAPOBJECTHANDLER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include "MIMPSSapObject.h"
       
    23 #include <s32strm.h>
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 /**
       
    30  * Object handler implementation
       
    31  * for generic MIMPSSapObject derived objects.
       
    32  *
       
    33  * Handles versioned objects and their data.
       
    34  * Can internalize data produced with newer
       
    35  * versions of software having more fields
       
    36  * than current implementation.
       
    37  *
       
    38  *
       
    39  * @since 3.0
       
    40  */
       
    41 NONSHARABLE_CLASS( IMPSSAPObjectHandler )
       
    42     {
       
    43 
       
    44 public:  // New methods
       
    45 
       
    46     /**
       
    47      * Gets the data size.
       
    48      *
       
    49      * Calculates the data size needed to externalize
       
    50      * given object using IMPSSAPObjectHandler::ExternalizeL()
       
    51      * service.
       
    52      *
       
    53      * @since 3.0
       
    54      * @param aObj  The object which data size to get.
       
    55      * @return The data size needed to externalize the
       
    56      * given object.
       
    57      */
       
    58     static TInt DataSize( const MIMPSSapObject& aObj );
       
    59 
       
    60 
       
    61     /**
       
    62      * Externalizes object to given write stream.
       
    63      *
       
    64      * Externalizes object to given write stream.
       
    65      * Stores additional version and control information
       
    66      * inside the stream so internalization can be
       
    67      * done later e.g with higher versioned component
       
    68      * having new data fields. This implementation is
       
    69      * tested with following stream types:
       
    70      * - file
       
    71      * - buffer
       
    72      *
       
    73      * NOTE! Versioning is based on usage of:
       
    74      *  - MIMPSSapObject::ObjectVersion()
       
    75      *  - MIMPSSapObject::ExternalizeVersionDataL()
       
    76      *  - MIMPSSapObject::InternalizeVersionDataL()
       
    77      *
       
    78      * @since 3.0
       
    79      * @param aObj The object to externalize.
       
    80      * @aStream aStream The stream to write the data.
       
    81      */
       
    82     static void ExternalizeL( const MIMPSSapObject& aObj,
       
    83                               RWriteStream& aStream );
       
    84 
       
    85 
       
    86     /**
       
    87      * Internalizes object from given read stream.
       
    88      *
       
    89      * Internalizes object from given read stream.
       
    90      * Reads additional version and control information
       
    91      * from the stream so internalization is capable to
       
    92      * read streams generated e.g with older versions
       
    93      * of component having fewer data fields.
       
    94      * This implementation is tested with the following
       
    95      * stream types:
       
    96      * - file
       
    97      * - buffer
       
    98      *
       
    99      * NOTE! Versioning is based on usage of:
       
   100      *  - MIMPSSapObject::ObjectVersion()
       
   101      *  - MIMPSSapObject::InternalizeVersionDataL()
       
   102      *
       
   103      * @since 3.0
       
   104      * @param aObj The object to internalize.
       
   105      * @aStream aStream The stream to read the data.
       
   106      */
       
   107     static void InternalizeL( MIMPSSapObject& aObj, RReadStream& aStream );
       
   108 
       
   109 
       
   110     /**
       
   111      * Copies given source data / state to
       
   112      * target object.
       
   113      *
       
   114      * @since 3.0
       
   115      * @param aSource The object to copy.
       
   116      * @param aTarget The target for copy,
       
   117      */
       
   118     static void CopyL( const MIMPSSapObject& aSource,
       
   119                        MIMPSSapObject& aTarget );
       
   120 
       
   121 
       
   122 
       
   123 private:  // Prohibited constructor & destructor
       
   124 
       
   125     IMPSSAPObjectHandler();
       
   126     ~IMPSSAPObjectHandler();
       
   127     };
       
   128 
       
   129 
       
   130 #endif      // __IMPSSAPOBJECTHANDLER_H
       
   131 
       
   132 //  End of File