ximpfw/presence/srcpresencedatamodel/presenceapidataobjfactory.h
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Codec to pack and unpack data objects.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PRESENCEAPIDATAOBJFACTORY_H
       
    19 #define PRESENCEAPIDATAOBJFACTORY_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "presencetypehelpers.h"
       
    23 #include "ximpapidataobjbase.h"
       
    24 
       
    25 // internal interface for the factory
       
    26 #include "apidataobjfactory.h"
       
    27 
       
    28 class RReadStream;
       
    29 class RWriteStream;
       
    30 
       
    31 
       
    32 /**
       
    33  * Codec to pack and unpack data object arrays.
       
    34  *
       
    35  * @lib ximpdatamodel.dll
       
    36  * @since S60 v3.2
       
    37  */
       
    38 NONSHARABLE_CLASS( CPresenceApiDataObjFactory ) : public CBase,
       
    39                                                   public MApiDataObjFactory
       
    40     {
       
    41 public:
       
    42 
       
    43     static CPresenceApiDataObjFactory* NewL();
       
    44     
       
    45     // From base class
       
    46     CXIMPApiDataObjBase* NewFromStreamLC( TInt32 aDataObjInterfaceId,
       
    47                                           RReadStream& aStream );
       
    48     /**
       
    49      * Unpacks a request parameter array from a 
       
    50      * descriptor back to array format.
       
    51      * @param aDataObjArrayData The packed array
       
    52      * @param aArray The array which to fill
       
    53      */
       
    54     static void InternalizeL( 
       
    55             RReadStream& aStream,
       
    56             RPresenceReqParamArray& aArray
       
    57             );
       
    58 
       
    59     /**
       
    60      * Packs a given request parameter array into 
       
    61      * a stream.
       
    62      * @param aWs The stream to pack into
       
    63      * @param aArray The array to pack
       
    64      */    
       
    65     static void ExternalizeL( 
       
    66             RWriteStream& aWs,
       
    67             const RPresenceReqParamArray& aArray
       
    68             );
       
    69 
       
    70     /**
       
    71      * Internalize a CXIMPApiDataObjBase-derived object
       
    72      * from the given stream, ownership is returned to the caller.
       
    73      * @param aStream The stream
       
    74      * @return The object instance
       
    75      */
       
    76     static CXIMPApiDataObjBase* InternalizeLC(
       
    77             RReadStream& aStream );
       
    78 
       
    79     /**
       
    80      * Externalize a CXIMPApiDataObjBase-derived object
       
    81      * to the given stream.
       
    82      * @param aWs The write stream
       
    83      * @param aDataObj The data object
       
    84      */
       
    85     static void ExternalizeL(
       
    86             RWriteStream& aWs,
       
    87             const CXIMPApiDataObjBase& aDataObj );
       
    88     
       
    89 
       
    90     /*
       
    91      * Packs a given array into a stream.
       
    92      * @param aStream The stream
       
    93      * @param aArray The array
       
    94      */
       
    95     template< class INFOIMP>    
       
    96         static inline void InternalizeL( 
       
    97                 RReadStream& aStream,
       
    98                 RPointerArray<INFOIMP>& aArray
       
    99                 );
       
   100 
       
   101     /**
       
   102      * Unpacks an array of info fields back to array format.
       
   103      * @param aWs The stream
       
   104      * @param aArray The array which to fill
       
   105      */
       
   106     template< class INFOIMP >
       
   107         static inline void ExternalizeL( 
       
   108                 RWriteStream& aWs,
       
   109                 const RPointerArray<INFOIMP>& aArray
       
   110                 );
       
   111 
       
   112 
       
   113     ~CPresenceApiDataObjFactory();
       
   114 private:
       
   115 
       
   116     CPresenceApiDataObjFactory();
       
   117 
       
   118     void ConstructL();
       
   119 
       
   120     };
       
   121 
       
   122 // template methods need inline implementation
       
   123 #include "presenceapidataobjfactory.inl"
       
   124 
       
   125 #endif // PRESENCEAPIDATAOBJFACTORY_H