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