imservices/searchfeatureplugin/srcsearchdatamodel/searcheventcodec.h
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     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:  Codec to pack and unpack event objects.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef SEARCHEVENTCODEC_H
       
    19 #define SEARCHEVENTCODEC_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 #include "eventcodec.h"
       
    24 
       
    25 class CXIMPApiEventBase;
       
    26 class RReadStream;
       
    27 
       
    28 
       
    29 /**
       
    30  * Codec to pack and unpack event objects.
       
    31  *
       
    32  * @lib searchdatamodel.dll
       
    33  */
       
    34 NONSHARABLE_CLASS( CSearchEventCodec ): public MEventCodec
       
    35     {
       
    36     
       
    37 public:
       
    38     static CSearchEventCodec* NewL();
       
    39     
       
    40     ~CSearchEventCodec();
       
    41     
       
    42     
       
    43     /**
       
    44      * packs and allocates memory for the  
       
    45      * event object and event type
       
    46      *
       
    47      * @param aEventObj  
       
    48      * event object derived from CXIMPApiEventBase
       
    49      * 
       
    50      * @param aTypeOfEvent 
       
    51      * holds  type of the event after execution from aEventObj
       
    52      * 
       
    53      * @return
       
    54      * heap allocated which contains both
       
    55      * event and event type
       
    56      */
       
    57     HBufC8* PackL( CXIMPApiEventBase& aEventObj,
       
    58                                    TInt32& aTypeOfEvent );
       
    59                                    
       
    60     /**
       
    61      * packs  
       
    62      * event object and event type into the buffer
       
    63      *
       
    64      * @param aEventObj  
       
    65      * event object derived from CXIMPApiEventBase
       
    66      * 
       
    67      * @param aTypeOfEvent 
       
    68      * holds  type of the event after execution from aEventObj 
       
    69      * 
       
    70      * @param
       
    71      * buffer to be packed  with
       
    72      * event and event type
       
    73      */                               
       
    74                                    
       
    75     void PackL( CXIMPApiEventBase& aEventObj,
       
    76                          TInt32& aTypeOfEvent,
       
    77                          CBufFlat* aBuffer );
       
    78 
       
    79     /**
       
    80      *
       
    81      * @param aEventData
       
    82      * data desc which has the event type and id
       
    83      *
       
    84      * @param aTypeOfEvent 
       
    85      * holds  type of the event after execution from aEventData 
       
    86      *
       
    87      * @return new eventbase object constructed from aEventData
       
    88      *
       
    89      */
       
    90     CXIMPApiEventBase* UnPackL( const TDesC8& aEventData,
       
    91                                                 TInt32& aTypeOfEvent );
       
    92 protected:
       
    93     void ConstructL();
       
    94 
       
    95 private:
       
    96 
       
    97     CSearchEventCodec();
       
    98 
       
    99 
       
   100     };
       
   101 
       
   102 
       
   103 #endif // SEARCHEVENTCODEC_H