|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "mdeeventdef.h" |
|
19 |
|
20 #include "mdcdef.h" |
|
21 #include "mdenamespacedef.h" |
|
22 #include "mdcserializationbuffer.h" |
|
23 |
|
24 |
|
25 CMdEEventDef::CMdEEventDef( const TMdCEventDef& aEventDef, CMdENamespaceDef& aNamespaceDef ) |
|
26 : iEventDef(aEventDef), iNamespaceDef(aNamespaceDef) |
|
27 { |
|
28 } |
|
29 |
|
30 CMdEEventDef* CMdEEventDef::NewL( const TMdCEventDef& aEventDef, |
|
31 CMdCSerializationBuffer& aSchemaBuffer, CMdENamespaceDef& aNamespaceDef ) |
|
32 { |
|
33 CMdEEventDef* def = CMdEEventDef::NewLC( aEventDef, aSchemaBuffer, aNamespaceDef ); |
|
34 CleanupStack::Pop( def ); |
|
35 return def; |
|
36 } |
|
37 |
|
38 CMdEEventDef* CMdEEventDef::NewLC( const TMdCEventDef& aEventDef, |
|
39 CMdCSerializationBuffer& aSchemaBuffer, CMdENamespaceDef& aNamespaceDef ) |
|
40 { |
|
41 CMdEEventDef* def = new( ELeave ) CMdEEventDef( aEventDef, aNamespaceDef ); |
|
42 CleanupStack::PushL( def ); |
|
43 def->ConstructL( aSchemaBuffer ); |
|
44 return def; |
|
45 } |
|
46 |
|
47 void CMdEEventDef::ConstructL( CMdCSerializationBuffer& aSchemaBuffer ) |
|
48 { |
|
49 aSchemaBuffer.PositionL( iEventDef.iName.iPtr.iOffset ); |
|
50 iName.Set( aSchemaBuffer.ReceivePtr16L() ); |
|
51 } |
|
52 |
|
53 CMdEEventDef::~CMdEEventDef() |
|
54 { |
|
55 } |
|
56 |
|
57 TDefId CMdEEventDef::Id() const |
|
58 { |
|
59 return iEventDef.iDefId; |
|
60 } |
|
61 |
|
62 EXPORT_C CMdENamespaceDef& CMdEEventDef::NamespaceDef() const |
|
63 { |
|
64 return iNamespaceDef; |
|
65 } |
|
66 |
|
67 EXPORT_C const TDesC& CMdEEventDef::Name() const |
|
68 { |
|
69 return iName; |
|
70 } |
|
71 |
|
72 EXPORT_C TInt CMdEEventDef::Compare( const CMdEEventDef& aEventDef ) const |
|
73 { |
|
74 TInt result = iNamespaceDef.Compare( aEventDef.iNamespaceDef ); |
|
75 if ( result == 0 ) |
|
76 { |
|
77 result = iEventDef.iDefId - aEventDef.Id(); |
|
78 } |
|
79 return result; |
|
80 } |