• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3  * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4  * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef WebDOMTestObj_h
24 #define WebDOMTestObj_h
25 
26 #include <WebDOMObject.h>
27 #include <WebDOMString.h>
28 
29 namespace WebCore {
30 class TestObj;
31 };
32 
33 class WebDOMEventListener;
34 class WebDOMIDBKey;
35 class WebDOMOptionsObject;
36 class WebDOMString;
37 class WebDOMTestObj;
38 
39 class WebDOMTestObj : public WebDOMObject {
40 public:
41     WebDOMTestObj();
42     explicit WebDOMTestObj(WebCore::TestObj*);
43     WebDOMTestObj(const WebDOMTestObj&);
44     WebDOMTestObj& operator=(const WebDOMTestObj&);
45     virtual ~WebDOMTestObj();
46 
47     enum {
48         WEBDOM_CONST_VALUE_0 = 0,
49         WEBDOM_CONST_VALUE_1 = 1,
50         WEBDOM_CONST_VALUE_2 = 2,
51         WEBDOM_CONST_VALUE_4 = 4,
52         WEBDOM_CONST_VALUE_8 = 8,
53         WEBDOM_CONST_VALUE_9 = -1,
54         WEBDOM_CONST_VALUE_10 = "my constant string",
55         WEBDOM_CONST_VALUE_11 = 0xffffffff,
56         WEBDOM_CONST_VALUE_12 = 0x01,
57         WEBDOM_CONST_VALUE_13 = 0X20,
58         WEBDOM_CONST_VALUE_14 = 0x1abc
59     };
60 
61     int readOnlyIntAttr() const;
62     WebDOMString readOnlyStringAttr() const;
63     WebDOMTestObj readOnlyTestObjAttr() const;
64     short shortAttr() const;
65     void setShortAttr(short);
66     unsigned short unsignedShortAttr() const;
67     void setUnsignedShortAttr(unsigned short);
68     int intAttr() const;
69     void setIntAttr(int);
70     long long longLongAttr() const;
71     void setLongLongAttr(long long);
72     unsigned long long unsignedLongLongAttr() const;
73     void setUnsignedLongLongAttr(unsigned long long);
74     WebDOMString stringAttr() const;
75     void setStringAttr(const WebDOMString&);
76     WebDOMTestObj testObjAttr() const;
77     void setTestObjAttr(const WebDOMTestObj&);
78     WebDOMTestObj XMLObjAttr() const;
79     void setXMLObjAttr(const WebDOMTestObj&);
80     bool create() const;
81     void setCreate(bool);
82     WebDOMString reflectedStringAttr() const;
83     void setReflectedStringAttr(const WebDOMString&);
84     int reflectedIntegralAttr() const;
85     void setReflectedIntegralAttr(int);
86     unsigned reflectedUnsignedIntegralAttr() const;
87     void setReflectedUnsignedIntegralAttr(unsigned);
88     bool reflectedBooleanAttr() const;
89     void setReflectedBooleanAttr(bool);
90     WebDOMString reflectedURLAttr() const;
91     void setReflectedURLAttr(const WebDOMString&);
92     WebDOMString reflectedNonEmptyURLAttr() const;
93     void setReflectedNonEmptyURLAttr(const WebDOMString&);
94     WebDOMString reflectedStringAttr() const;
95     void setReflectedStringAttr(const WebDOMString&);
96     int reflectedCustomIntegralAttr() const;
97     void setReflectedCustomIntegralAttr(int);
98     bool reflectedCustomBooleanAttr() const;
99     void setReflectedCustomBooleanAttr(bool);
100     WebDOMString reflectedCustomURLAttr() const;
101     void setReflectedCustomURLAttr(const WebDOMString&);
102     WebDOMString reflectedCustomNonEmptyURLAttr() const;
103     void setReflectedCustomNonEmptyURLAttr(const WebDOMString&);
104     int attrWithGetterException() const;
105     void setAttrWithGetterException(int);
106     int attrWithSetterException() const;
107     void setAttrWithSetterException(int);
108     WebDOMString stringAttrWithGetterException() const;
109     void setStringAttrWithGetterException(const WebDOMString&);
110     WebDOMString stringAttrWithSetterException() const;
111     void setStringAttrWithSetterException(const WebDOMString&);
112     int customAttr() const;
113     void setCustomAttr(int);
114     WebDOMString scriptStringAttr() const;
115 #if ENABLE(Condition1)
116     int conditionalAttr1() const;
117     void setConditionalAttr1(int);
118 #endif
119 #if ENABLE(Condition1) && ENABLE(Condition2)
120     int conditionalAttr2() const;
121     void setConditionalAttr2(int);
122 #endif
123 #if ENABLE(Condition1) || ENABLE(Condition2)
124     int conditionalAttr3() const;
125     void setConditionalAttr3(int);
126 #endif
127     int description() const;
128     int id() const;
129     void setId(int);
130     WebDOMString hash() const;
131 
132     void voidMethod();
133     void voidMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
134     int intMethod();
135     int intMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
136     WebDOMTestObj objMethod();
137     WebDOMTestObj objMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
138     WebDOMTestObj methodThatRequiresAllArgs(const WebDOMString& strArg, const WebDOMTestObj& objArg);
139     WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg);
140     void serializedValue(const WebDOMString& serializedArg);
141     void idbKey(const WebDOMIDBKey& key);
142     void optionsObject(const WebDOMOptionsObject& oo, const WebDOMOptionsObject& ooo);
143     void methodWithException();
144     void customMethod();
145     void customMethodWithArgs(int intArg, const WebDOMString& strArg, const WebDOMTestObj& objArg);
146     void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture);
147     void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture);
148     void withDynamicFrame();
149     void withDynamicFrameAndArg(int intArg);
150     void withDynamicFrameAndOptionalArg(int intArg, int optionalArg);
151     void withDynamicFrameAndUserGesture(int intArg);
152     void withDynamicFrameAndUserGestureASAD(int intArg, int optionalArg);
153     void withScriptStateVoid();
154     WebDOMTestObj withScriptStateObj();
155     void withScriptStateVoidException();
156     WebDOMTestObj withScriptStateObjException();
157     void withScriptExecutionContext();
158     void methodWithOptionalArg(int opt);
159     void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt);
160     void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2);
161     void classMethod();
162     int classMethodWithOptional(int arg);
163 
164     WebCore::TestObj* impl() const;
165 
166 protected:
167     struct WebDOMTestObjPrivate;
168     WebDOMTestObjPrivate* m_impl;
169 };
170 
171 WebCore::TestObj* toWebCore(const WebDOMTestObj&);
172 WebDOMTestObj toWebKit(WebCore::TestObj*);
173 
174 #endif
175