|
1 /* |
|
2 * Copyright (c) 2004 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: This interface defines a generic data type |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef I_ALFVARIANTTYPE_H |
|
21 #define I_ALFVARIANTTYPE_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <osn/osntypes.h> |
|
27 #include <alf/ialfmodelbase.h> |
|
28 |
|
29 namespace osncore |
|
30 { |
|
31 class UString; |
|
32 } |
|
33 |
|
34 using namespace osncore; |
|
35 |
|
36 namespace Alf |
|
37 { |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class IAlfContainer; |
|
41 class IAlfMap; |
|
42 class IAlfBranch; |
|
43 class IAlfModelBase; |
|
44 |
|
45 //INTERFACE DECLARATIONS |
|
46 |
|
47 /** |
|
48 * An interface for variant data type. |
|
49 * Application-specific data source classes may implement |
|
50 * this interface. Alternatively, a wrapper class may |
|
51 * be implemented to convert data fields from application source |
|
52 * to some IAlfVariantType implementation (e.g., CAlfVariantType). |
|
53 * |
|
54 * @lib alfwidgetmodel.lib |
|
55 * @since S60 ?S60_version |
|
56 * @status Draft |
|
57 */ |
|
58 class IAlfVariantType |
|
59 { |
|
60 public: |
|
61 /** Type enumeration. */ |
|
62 enum Type{EBool, EInt, EUint, EReal, EString, EContainer, EMap, EBranch,ECustomData}; |
|
63 |
|
64 /** Virtual destructor. */ |
|
65 virtual ~IAlfVariantType() {} |
|
66 |
|
67 /** |
|
68 * Set the Data the variantData |
|
69 * |
|
70 * @param aValue The new value. |
|
71 * @since S60 ?S60_version |
|
72 */ |
|
73 virtual void set(IAlfVariantType& aValue) = 0; |
|
74 |
|
75 /** |
|
76 * Get the data type. |
|
77 * |
|
78 * @return The data type. |
|
79 * @since S60 ?S60_version |
|
80 */ |
|
81 virtual Type type() const = 0; |
|
82 |
|
83 /** |
|
84 * Get the data value as an bool . |
|
85 * |
|
86 * @exception osncore:AlfDataException Thrown if type() is not EBool. |
|
87 * @return bool data value. |
|
88 * @since S60 ?S60_version |
|
89 */ |
|
90 virtual bool boolean() const = 0; |
|
91 |
|
92 /** |
|
93 * Get the data value as an integer. |
|
94 * |
|
95 * @exception osncore:AlfDataException Thrown if type() is not EInt. |
|
96 * @return Integer data value. |
|
97 * @since S60 ?S60_version |
|
98 */ |
|
99 virtual int integer() const = 0; |
|
100 |
|
101 /** |
|
102 * Get the data value as an unsigned integer. |
|
103 * |
|
104 * @exception osncore:AlfDataException Thrown if type() is not EUInt. |
|
105 * @return Unsigned integer data value. |
|
106 * @since S60 ?S60_version |
|
107 */ |
|
108 virtual uint uinteger() const = 0; |
|
109 |
|
110 /** |
|
111 * Get the data value as a real number. |
|
112 * |
|
113 * @exception osncore:AlfDataException Thrown if type() is not EReal. |
|
114 * @return Real data value. |
|
115 * @since S60 ?S60_version |
|
116 */ |
|
117 virtual double real() const = 0; |
|
118 |
|
119 /** |
|
120 * Get the data value as a descriptor. |
|
121 * |
|
122 * @exception osncore:AlfDataException Thrown if type() is not EString. |
|
123 * @return string value. |
|
124 * @since S60 ?S60_version |
|
125 */ |
|
126 virtual const UString& string() const = 0; |
|
127 |
|
128 /** |
|
129 * Get the data value as a container interface. |
|
130 * |
|
131 * @exception osncore:AlfDataException Thrown if type() is not EContainer. |
|
132 * @return Container interface. |
|
133 * @since S60 ?S60_version |
|
134 */ |
|
135 virtual IAlfContainer* container() = 0; |
|
136 |
|
137 /** |
|
138 * Get the data value as a map interface. |
|
139 * |
|
140 * @exception osncore:AlfDataException Thrown if type() is not EMap. |
|
141 * @return Map interface. |
|
142 * @since S60 ?S60_version |
|
143 */ |
|
144 virtual IAlfMap* map() = 0; |
|
145 |
|
146 /** |
|
147 * Get the data value as a Branch interface. |
|
148 * |
|
149 * @exception osncore:AlfDataException Thrown if type() is not EBranch. |
|
150 * @return Branch interface. |
|
151 * @since S60 ?S60_version |
|
152 */ |
|
153 virtual IAlfBranch* branch() = 0; |
|
154 |
|
155 /** |
|
156 * Get the data value as a User Defined Data Pointer. |
|
157 * |
|
158 * @exception osncore:AlfDataException Thrown if type() is not ECustomData. |
|
159 * @return CAlfModelBase interface. |
|
160 * @since S60 ?S60_version |
|
161 */ |
|
162 virtual IAlfModelBase* customData() = 0; |
|
163 |
|
164 }; |
|
165 |
|
166 } // namespace Alf |
|
167 |
|
168 #endif // I_ALFVARIANTTYPE_H |
|
169 |
|
170 // End of File |