|
1 /* |
|
2 * Copyright (c) 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MDEOBJECTDEF_H__ |
|
20 #define __MDEOBJECTDEF_H__ |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 //#include <uri16.h> |
|
25 |
|
26 #include <mdccommon.h> |
|
27 |
|
28 // Forward declaration |
|
29 class CMdEPropertyDef; |
|
30 class CMdCSerializationBuffer; |
|
31 class CMdENamespaceDef; |
|
32 class TMdCObjectDef; |
|
33 |
|
34 /** |
|
35 * Object definition. |
|
36 */ |
|
37 NONSHARABLE_CLASS(CMdEObjectDef) : public CBase |
|
38 { |
|
39 public: |
|
40 IMPORT_C CMdEObjectDef* ParentL(); |
|
41 |
|
42 /** |
|
43 * Returns the name of the item. |
|
44 * |
|
45 * @return name |
|
46 */ |
|
47 IMPORT_C const TDesC& Name() const; |
|
48 |
|
49 /** |
|
50 * Returns the number of property definitions. |
|
51 * |
|
52 * @return number of property definitions |
|
53 */ |
|
54 IMPORT_C TInt PropertyDefCount() const; |
|
55 |
|
56 /** |
|
57 * Returns the property definition at the specified index. |
|
58 * |
|
59 * @return property definition |
|
60 */ |
|
61 IMPORT_C CMdEPropertyDef& PropertyDefL(TInt aIndex); |
|
62 |
|
63 /** |
|
64 * Returns the property definition with the specified name. |
|
65 * |
|
66 * @param aName name |
|
67 * |
|
68 * @return property definition; |
|
69 * or 0 if there is no property definition with the specified name |
|
70 */ |
|
71 IMPORT_C CMdEPropertyDef& GetPropertyDefL(const TDesC& aName); |
|
72 |
|
73 /** |
|
74 * Compare this object definition with other object definition. |
|
75 * |
|
76 * @param aObjectDef other object definition |
|
77 * |
|
78 * @return 0 if objects are same, 1 or more if this is greater than other |
|
79 * and -1 or less if this is less than other. |
|
80 */ |
|
81 IMPORT_C TInt Compare(const CMdEObjectDef& aObjectDef) const; |
|
82 |
|
83 /** |
|
84 * Returns namespacedef where this objectdef belongs to. |
|
85 * @Return namespacedef where this objectdef belongs to. |
|
86 */ |
|
87 IMPORT_C CMdENamespaceDef& NamespaceDef() const; |
|
88 |
|
89 public: |
|
90 static CMdEObjectDef* NewL(const TMdCObjectDef& aObjectDef, CMdCSerializationBuffer& aSchemaBuffer, CMdENamespaceDef& aNamespaceDef ); |
|
91 |
|
92 static CMdEObjectDef* NewLC(const TMdCObjectDef& aObjectDef, CMdCSerializationBuffer& aSchemaBuffer, CMdENamespaceDef& aNamespaceDef ); |
|
93 |
|
94 /** |
|
95 * Destructor. |
|
96 */ |
|
97 virtual ~CMdEObjectDef(); |
|
98 |
|
99 IMPORT_C TDefId Id() const; |
|
100 |
|
101 /** |
|
102 * Returns the property definition with the specified id |
|
103 * |
|
104 * @param aId id |
|
105 * |
|
106 * @return property definition; |
|
107 * or <code>NULL</code> if there is no property definition with the specified id |
|
108 */ |
|
109 CMdEPropertyDef* GetPropertyDefL(TDefId aId, CMdEObjectDef* aChild = NULL); |
|
110 |
|
111 private: |
|
112 CMdEObjectDef(const TMdCObjectDef& aObjectDef, CMdENamespaceDef& aNamespaceDef); |
|
113 |
|
114 CMdEPropertyDef* PropertyDefL(TInt aIndex, CMdEObjectDef* aChild); |
|
115 |
|
116 CMdEPropertyDef* GetPropertyDefL(const TDesC& aName, CMdEObjectDef* aChild); |
|
117 |
|
118 void ConstructL(CMdCSerializationBuffer& aSchemaBuffer); |
|
119 |
|
120 static TInt CompareProperties(const CMdEPropertyDef& aFirst, const CMdEPropertyDef& aSecond); |
|
121 |
|
122 private: |
|
123 const TMdCObjectDef& iObjectDef; |
|
124 CMdENamespaceDef& iNamespaceDef; |
|
125 |
|
126 TPtrC16 iName; |
|
127 |
|
128 RPointerArray<CMdEPropertyDef> iPropertyDefs; |
|
129 }; |
|
130 |
|
131 #endif // __MDEOBJECTDEF_H__ |