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