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