|
1 /* |
|
2 * Copyright (c) 2007 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 the License "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 |
|
19 #ifndef __DEVICELIWMAP_H |
|
20 #define __DEVICELIWMAP_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <object.h> |
|
24 |
|
25 /** |
|
26 * Device |
|
27 * |
|
28 * @lib jsdevice.dll |
|
29 * @since 5.0 |
|
30 */ |
|
31 |
|
32 class CLiwMap; |
|
33 namespace KJS |
|
34 { |
|
35 class CDeviceLiwBinding; |
|
36 class DeviceLiwMapPrivate; |
|
37 class DeviceLiwMap: public JSObject |
|
38 { |
|
39 |
|
40 public: // constructor and destructor |
|
41 |
|
42 /** |
|
43 * Constructor |
|
44 * @return none |
|
45 * @since 5.0 |
|
46 **/ |
|
47 DeviceLiwMap( JSValue* proto, const CLiwMap* liwMap, CDeviceLiwBinding* liwBinding); |
|
48 |
|
49 |
|
50 /** |
|
51 * Destructor |
|
52 * @return none |
|
53 * @since 5.0 |
|
54 **/ |
|
55 virtual ~DeviceLiwMap(); |
|
56 |
|
57 |
|
58 public: // From JSObject |
|
59 |
|
60 /** |
|
61 * getOwnPropertySlot |
|
62 * @return bool |
|
63 * @since 5.0 |
|
64 **/ |
|
65 bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot); |
|
66 /** |
|
67 * getValueProperty |
|
68 * @return JSValue* |
|
69 * @since 5.0 |
|
70 **/ |
|
71 JSValue* getValueProperty(KJS::ExecState* exec, int token) const; |
|
72 |
|
73 /** |
|
74 * class info |
|
75 * @return const ClassInfo* |
|
76 * @since 5.0 |
|
77 **/ |
|
78 const ClassInfo* classInfo() const { return &info; } |
|
79 |
|
80 /** |
|
81 * whether this object is valid |
|
82 * @return boolean |
|
83 * @since 5.0 |
|
84 */ |
|
85 const bool isValid() const { return m_valid; } |
|
86 |
|
87 /** |
|
88 * close jsobject array |
|
89 * @return |
|
90 * @since 5.0 |
|
91 **/ |
|
92 void Close(ExecState* exec, bool unmark ); |
|
93 |
|
94 /** |
|
95 * toString |
|
96 * @return UString |
|
97 * @since 5.0 |
|
98 **/ |
|
99 virtual UString toString( ExecState* exec ) const; |
|
100 |
|
101 static const ClassInfo info; |
|
102 enum |
|
103 { |
|
104 close |
|
105 }; |
|
106 |
|
107 private: |
|
108 |
|
109 DeviceLiwMapPrivate* m_privateData; // private object to hold data |
|
110 bool m_valid; // object is valid or not |
|
111 }; |
|
112 |
|
113 class DeviceLiwMapPrivate |
|
114 { |
|
115 friend class DeviceLiwMap; |
|
116 friend class DeviceLiwMapFunc; |
|
117 public: |
|
118 DeviceLiwMapPrivate(const CLiwMap* liwMap, CDeviceLiwBinding* liwBinding); |
|
119 ~DeviceLiwMapPrivate() { Close(); } |
|
120 void Close(); |
|
121 CDeviceLiwBinding* m_liwBinding; // not Owned |
|
122 Identifier m_propName; |
|
123 CLiwMap* m_liwMap; // not owned |
|
124 }; |
|
125 |
|
126 class DeviceLiwMapFunc : public JSObject |
|
127 { |
|
128 public: // constructor and destructor |
|
129 |
|
130 /** |
|
131 * Constructor |
|
132 * @return none |
|
133 * @since 5.0 |
|
134 **/ |
|
135 DeviceLiwMapFunc( ExecState* exec, int token ); |
|
136 |
|
137 /** |
|
138 * Destructor |
|
139 * @return none |
|
140 * @since 5.0 |
|
141 **/ |
|
142 virtual ~DeviceLiwMapFunc() {} |
|
143 |
|
144 public: // From ObjectImp JSObject |
|
145 |
|
146 /** |
|
147 * Whether implements the call |
|
148 * @return bool |
|
149 * @since 5.0 |
|
150 **/ |
|
151 bool implementsCall() const { return true; } |
|
152 |
|
153 /** |
|
154 * Call the function |
|
155 * @return Value |
|
156 * @since 5.0 |
|
157 **/ |
|
158 JSValue* callAsFunction(ExecState *exec, JSObject *thisObj, const List &args); |
|
159 |
|
160 private: |
|
161 int m_func; |
|
162 }; |
|
163 |
|
164 } |
|
165 #include "DeviceLiwMap.lut.h" |
|
166 #endif //__DEVICE_H |