|
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: Class to hold description about one item definition |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MDSITEMDEF_H__ |
|
19 #define __MDSITEMDEF_H__ |
|
20 |
|
21 #include "mdscommoninternal.h" |
|
22 |
|
23 class CMdCSerializationBuffer; |
|
24 |
|
25 /* |
|
26 * All item definitions should inherit from this one |
|
27 */ |
|
28 class CMdsItemDef : public CBase |
|
29 { |
|
30 public: |
|
31 /** |
|
32 * Destructor |
|
33 */ |
|
34 virtual ~CMdsItemDef(); |
|
35 |
|
36 /** |
|
37 * Get object name |
|
38 * @return object name |
|
39 */ |
|
40 inline const TDesC& GetName() const; |
|
41 |
|
42 /** |
|
43 * Get object Id |
|
44 * @return object Id |
|
45 */ |
|
46 inline TDefId GetId() const; |
|
47 |
|
48 /** |
|
49 * Sets object Id |
|
50 * param aId id which is assigned to event |
|
51 */ |
|
52 inline void SetId(const TDefId aId); |
|
53 |
|
54 /* |
|
55 * Set that item is already stored in DB |
|
56 */ |
|
57 inline void SetAllNotStoredInDB(); |
|
58 |
|
59 /** |
|
60 * Sets EStoredFlagsDB flag on. |
|
61 */ |
|
62 inline void SetStoredInDB(); |
|
63 |
|
64 /** |
|
65 * @return ETrue if EStoredFlagsDB flag is set. |
|
66 */ |
|
67 inline TBool GetStoredInDB() const; |
|
68 |
|
69 /** |
|
70 * Sets EStoredFlagsTable flag on. |
|
71 */ |
|
72 inline void SetTableStoredInDB(); |
|
73 |
|
74 /** |
|
75 * @return ETrue if EStoredFlagsTable flag is set. |
|
76 */ |
|
77 inline TBool GetTableStoredInDB() const; |
|
78 |
|
79 /** |
|
80 * stores defined flag |
|
81 */ |
|
82 inline void SetFlag( TStoredFlags aFlag ); |
|
83 inline TBool GetFlag( TStoredFlags aFlag ) const; |
|
84 |
|
85 /** |
|
86 * Get required size of serialized buffer when this is serialized. |
|
87 * |
|
88 * @return required size of serialized buffer |
|
89 */ |
|
90 TUint32 RequiredBufferSize(); |
|
91 |
|
92 /** |
|
93 * Serialize own data to serialized buffer (correct position must be set |
|
94 * before calling) and return new position of serialized buffer. |
|
95 * |
|
96 * @param aBuffer serialized buffer. |
|
97 */ |
|
98 TMdCOffset SerializeL(CMdCSerializationBuffer& aBuffer); |
|
99 |
|
100 protected: |
|
101 /** |
|
102 * Default constructor |
|
103 */ |
|
104 inline CMdsItemDef() |
|
105 {} |
|
106 |
|
107 /** |
|
108 * 2nd phase construction |
|
109 * @param aName name of event |
|
110 * @param aPriority priority of event |
|
111 */ |
|
112 void ConstructL( const TDesC& aName ); |
|
113 |
|
114 /** |
|
115 * Check name of schema definition against allowed characters |
|
116 * (A-Z, a-z, 0-9). First character can't be number. |
|
117 * |
|
118 * Leaves with error code not equal to KErrNone if aName contains |
|
119 * forbidden character(s). |
|
120 * |
|
121 * @param aName name of schema definition |
|
122 * @param aAllowNumbers are numbers allowed |
|
123 */ |
|
124 void CheckAllowerCharatersL( const TDesC& aName, TBool aAllowNumbers ); |
|
125 |
|
126 private: |
|
127 /** |
|
128 * Check name of schema definition against reserved word. |
|
129 * |
|
130 * Leaves with error code not equal to KErrNone if aName is reserved |
|
131 * word. |
|
132 * |
|
133 * @param aName name of schema definition |
|
134 */ |
|
135 void CheckReservedWordsL( const TDesC& aName ); |
|
136 |
|
137 /** |
|
138 * Check that character is allowed alphabet (A-Z, a-z). |
|
139 * |
|
140 * @param aChar character to be checked |
|
141 */ |
|
142 void CheckAlphabetL( TUint16 aChar ); |
|
143 |
|
144 /** |
|
145 * Check that character is allowed alphabet (A-Z, a-z) or number (0-9). |
|
146 * |
|
147 * @param aChar character to be checked |
|
148 */ |
|
149 void CheckAlphabetOrNumberL( TUint16 aChar ); |
|
150 |
|
151 private: // data |
|
152 |
|
153 /** |
|
154 * ObjectDef Name |
|
155 */ |
|
156 HBufC* iName; |
|
157 |
|
158 /** |
|
159 * ItemDef Id |
|
160 */ |
|
161 TDefId iId; |
|
162 |
|
163 /** |
|
164 * Tells if object is stored in DB |
|
165 */ |
|
166 TUint32 iStoredFlags; |
|
167 }; |
|
168 |
|
169 #include "mdsitemdef.inl" |
|
170 |
|
171 #endif /*__MDSITEMDEF_H__*/ |