|
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: API data object base implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CXIMPAPIDATAOBJBASE_H |
|
19 #define CXIMPAPIDATAOBJBASE_H |
|
20 |
|
21 #include "ximpapiobjbase.h" |
|
22 |
|
23 class RWriteStream; |
|
24 class RReadStream; |
|
25 |
|
26 |
|
27 /** |
|
28 * API event object base. |
|
29 * |
|
30 * Concrete event types must implement static |
|
31 * NewFromStreamLC() constructor and event types |
|
32 * must be registered to event automation system. |
|
33 * |
|
34 * For details, see XIMPEventCodec implementation. |
|
35 * @lib ximpdatamodel.dll |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 class CXIMPApiDataObjBase : public CXIMPApiObjBase |
|
39 { |
|
40 public: |
|
41 |
|
42 enum { KClassId = XIMPIMP_CLSID_CXIMPAPIDATAOBJBASE }; |
|
43 |
|
44 public: |
|
45 |
|
46 IMPORT_C CXIMPApiDataObjBase(); |
|
47 |
|
48 IMPORT_C virtual ~CXIMPApiDataObjBase(); |
|
49 |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Compare the content of this data object with another |
|
54 * data object of the same type. |
|
55 * Volatile things (e.g. timestamps) are not compared, but things like user |
|
56 * ids and such are. |
|
57 * @return ETrue if the content matches. |
|
58 */ |
|
59 virtual TBool EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const = 0; |
|
60 |
|
61 /** |
|
62 * Virtual extenalize method for concrete data |
|
63 * objects to externalize their data. |
|
64 */ |
|
65 virtual void ExternalizeL( RWriteStream& aStream ) const = 0; |
|
66 }; |
|
67 |
|
68 |
|
69 |
|
70 /** |
|
71 * Declares CXIMPApiDataObjBase methods for |
|
72 * concrete event implementation class header (.h) file. |
|
73 */ |
|
74 #define XIMPIMP_DECLARE_DATAOBJ_BASE_METHODS \ |
|
75 void ExternalizeL( RWriteStream& aStream ) const; \ |
|
76 IMPORT_C static CXIMPApiDataObjBase* NewFromStreamLC( RReadStream& aStream ); \ |
|
77 virtual TBool EqualsContent( const CXIMPApiDataObjBase& aOtherInstance ) const; \ |
|
78 |
|
79 #define XIMPIMP_DECLARE_DATAOBJ_BASE_PRIV_METHODS \ |
|
80 // void ConstructL( RReadStream& aStream ); \ |
|
81 |
|
82 |
|
83 /** |
|
84 * Implements a NewFromStreamLC method |
|
85 */ |
|
86 #define XIMPIMP_IMPLEMENT_DATAOBJ_NEWFROMSTREAM( TheClass ) \ |
|
87 EXPORT_C CXIMPApiDataObjBase* TheClass::NewFromStreamLC( RReadStream& aStream ) \ |
|
88 { \ |
|
89 TheClass* self = new( ELeave ) TheClass; \ |
|
90 CleanupStack::PushL( self ); \ |
|
91 self->ConstructL(); \ |
|
92 self->InternalizeL( aStream ); \ |
|
93 return self; \ |
|
94 } \ |
|
95 |
|
96 #endif // CXIMPAPIDATAOBJBASE_H |