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 29namespace WebCore { 30class TestObj; 31}; 32 33class WebDOMDictionary; 34class WebDOMDocument; 35class WebDOMEventListener; 36class WebDOMNode; 37class WebDOMObject; 38class WebDOMSVGPoint; 39class WebDOMString; 40class WebDOMTestEnumType; 41class WebDOMTestNode; 42class WebDOMTestObj; 43class WebDOMbool; 44 45class WebDOMTestObj : public WebDOMObject { 46public: 47 WebDOMTestObj(); 48 explicit WebDOMTestObj(WebCore::TestObj*); 49 WebDOMTestObj(const WebDOMTestObj&); 50 WebDOMTestObj& operator=(const WebDOMTestObj&); 51 virtual ~WebDOMTestObj(); 52 53 enum { 54#if ENABLE(Condition1) 55 WEBDOM_CONDITIONAL_CONST = 0, 56#endif 57 WEBDOM_CONST_VALUE_0 = 0, 58 WEBDOM_CONST_VALUE_1 = 1, 59 WEBDOM_CONST_VALUE_2 = 2, 60 WEBDOM_CONST_VALUE_4 = 4, 61 WEBDOM_CONST_VALUE_8 = 8, 62 WEBDOM_CONST_VALUE_9 = -1, 63 WEBDOM_CONST_VALUE_10 = "my constant string", 64 WEBDOM_CONST_VALUE_11 = 0xffffffff, 65 WEBDOM_CONST_VALUE_12 = 0x01, 66 WEBDOM_CONST_VALUE_13 = 0X20, 67 WEBDOM_CONST_VALUE_14 = 0x1abc, 68 WEBDOM_CONST_JAVASCRIPT = 15 69 }; 70 71 int readOnlyLongAttr() const; 72 WebDOMString readOnlyStringAttr() const; 73 WebDOMTestObj readOnlyTestObjAttr() const; 74 char byteAttr() const; 75 void setByteAttr(char); 76 unsigned char octetAttr() const; 77 void setOctetAttr(unsigned char); 78 short shortAttr() const; 79 void setShortAttr(short); 80 unsigned short unsignedShortAttr() const; 81 void setUnsignedShortAttr(unsigned short); 82 int longAttr() const; 83 void setLongAttr(int); 84 long long longLongAttr() const; 85 void setLongLongAttr(long long); 86 unsigned long long unsignedLongLongAttr() const; 87 void setUnsignedLongLongAttr(unsigned long long); 88 WebDOMString stringAttr() const; 89 void setStringAttr(const WebDOMString&); 90 WebDOMTestObj testObjAttr() const; 91 void setTestObjAttr(const WebDOMTestObj&); 92 WebDOMTestObj XMLObjAttr() const; 93 void setXMLObjAttr(const WebDOMTestObj&); 94 bool create() const; 95 void setCreate(bool); 96 WebDOMString reflectedStringAttr() const; 97 void setReflectedStringAttr(const WebDOMString&); 98 int reflectedIntegralAttr() const; 99 void setReflectedIntegralAttr(int); 100 unsigned reflectedUnsignedIntegralAttr() const; 101 void setReflectedUnsignedIntegralAttr(unsigned); 102 bool reflectedBooleanAttr() const; 103 void setReflectedBooleanAttr(bool); 104 WebDOMString reflectedURLAttr() const; 105 void setReflectedURLAttr(const WebDOMString&); 106 WebDOMString reflectedStringAttr() const; 107 void setReflectedStringAttr(const WebDOMString&); 108 int reflectedCustomIntegralAttr() const; 109 void setReflectedCustomIntegralAttr(int); 110 bool reflectedCustomBooleanAttr() const; 111 void setReflectedCustomBooleanAttr(bool); 112 WebDOMString reflectedCustomURLAttr() const; 113 void setReflectedCustomURLAttr(const WebDOMString&); 114 int attrWithGetterException() const; 115 void setAttrWithGetterException(int); 116 int attrWithSetterException() const; 117 void setAttrWithSetterException(int); 118 WebDOMString stringAttrWithGetterException() const; 119 void setStringAttrWithGetterException(const WebDOMString&); 120 WebDOMString stringAttrWithSetterException() const; 121 void setStringAttrWithSetterException(const WebDOMString&); 122#if ENABLE(Condition1) 123 int conditionalAttr1() const; 124 void setConditionalAttr1(int); 125#endif 126#if ENABLE(Condition1) && ENABLE(Condition2) 127 int conditionalAttr2() const; 128 void setConditionalAttr2(int); 129#endif 130#if ENABLE(Condition1) || ENABLE(Condition2) 131 int conditionalAttr3() const; 132 void setConditionalAttr3(int); 133#endif 134 WebDOMObject anyAttribute() const; 135 void setAnyAttribute(const WebDOMObject&); 136 WebDOMDocument contentDocument() const; 137 WebDOMSVGPoint mutablePoint() const; 138 void setMutablePoint(const WebDOMSVGPoint&); 139 WebDOMSVGPoint immutablePoint() const; 140 void setImmutablePoint(const WebDOMSVGPoint&); 141 int strawberry() const; 142 void setStrawberry(int); 143 float strictFloat() const; 144 void setStrictFloat(float); 145 int description() const; 146 int id() const; 147 void setId(int); 148 WebDOMString hash() const; 149 int replaceableAttribute() const; 150 double nullableDoubleAttribute() const; 151 int nullableLongAttribute() const; 152 bool nullableBooleanAttribute() const; 153 WebDOMString nullableStringAttribute() const; 154 int nullableLongSettableAttribute() const; 155 void setNullableLongSettableAttribute(int); 156 int nullableStringValue() const; 157 void setNullableStringValue(int); 158 159 void voidMethod(); 160 void voidMethodWithArgs(int longArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); 161 char byteMethod(); 162 char byteMethodWithArgs(char byteArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); 163 unsigned char octetMethod(); 164 unsigned char octetMethodWithArgs(unsigned char octetArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); 165 int longMethod(); 166 int longMethodWithArgs(int longArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); 167 WebDOMTestObj objMethod(); 168 WebDOMTestObj objMethodWithArgs(int longArg, const WebDOMString& strArg, const WebDOMTestObj& objArg); 169 void methodWithEnumArg(const WebDOMTestEnumType& enumArg); 170 WebDOMTestObj methodThatRequiresAllArgsAndThrows(const WebDOMString& strArg, const WebDOMTestObj& objArg); 171 void serializedValue(const WebDOMString& serializedArg); 172 void optionsObject(const WebDOMDictionary& oo, const WebDOMDictionary& ooo); 173 void methodWithException(); 174 void addEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); 175 void removeEventListener(const WebDOMString& type, const WebDOMEventListener& listener, bool useCapture); 176 void methodWithOptionalArg(int opt); 177 void methodWithNonOptionalArgAndOptionalArg(int nonOpt, int opt); 178 void methodWithNonOptionalArgAndTwoOptionalArgs(int nonOpt, int opt1, int opt2); 179 void methodWithOptionalString(const WebDOMString& str); 180 void methodWithOptionalStringIsUndefined(const WebDOMString& str); 181 void methodWithOptionalStringIsNullString(const WebDOMString& str); 182#if ENABLE(Condition1) 183 WebDOMString conditionalMethod1(); 184#endif 185#if ENABLE(Condition1) && ENABLE(Condition2) 186 void conditionalMethod2(); 187#endif 188#if ENABLE(Condition1) || ENABLE(Condition2) 189 void conditionalMethod3(); 190#endif 191 void classMethod(); 192 int classMethodWithOptional(int arg); 193#if ENABLE(Condition1) 194 void overloadedMethod1(int arg); 195#endif 196#if ENABLE(Condition1) 197 void overloadedMethod1(const WebDOMString& type); 198#endif 199 void convert1(const WebDOMTestNode& value); 200 void convert2(const WebDOMTestNode& value); 201 void convert4(const WebDOMTestNode& value); 202 void convert5(const WebDOMTestNode& value); 203 WebDOMSVGPoint mutablePointFunction(); 204 WebDOMSVGPoint immutablePointFunction(); 205 void banana(); 206 WebDOMbool strictFunction(const WebDOMString& str, float a, int b); 207 void variadicStringMethod(const WebDOMString& head, const WebDOMString& tail); 208 void variadicDoubleMethod(double head, double tail); 209 void variadicNodeMethod(const WebDOMNode& head, const WebDOMNode& tail); 210 211 WebCore::TestObj* impl() const; 212 213protected: 214 struct WebDOMTestObjPrivate; 215 WebDOMTestObjPrivate* m_impl; 216}; 217 218WebCore::TestObj* toWebCore(const WebDOMTestObj&); 219WebDOMTestObj toWebKit(WebCore::TestObj*); 220 221#endif 222