khtml Library API Documentation

xmlhttprequest.cpp

00001 // -*- c-basic-offset: 2 -*- 00002 /* 00003 * This file is part of the KDE libraries 00004 * Copyright (C) 2003 Apple Computer, Inc. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 #include "xmlhttprequest.h" 00022 #include "xmlhttprequest.lut.h" 00023 00024 #include <kdebug.h> 00025 00026 using namespace KJS; 00027 00029 00030 /* Source for XMLHttpRequestProtoTable. 00031 @begin XMLHttpRequestProtoTable 7 00032 abort XMLHttpRequest::Abort DontDelete|Function 0 00033 getAllResponseHeaders XMLHttpRequest::GetAllResponseHeaders DontDelete|Function 0 00034 getResponseHeader XMLHttpRequest::GetResponseHeader DontDelete|Function 1 00035 open XMLHttpRequest::Open DontDelete|Function 5 00036 send XMLHttpRequest::Send DontDelete|Function 1 00037 setRequestHeader XMLHttpRequest::SetRequestHeader DontDelete|Function 2 00038 @end 00039 */ 00040 DEFINE_PROTOTYPE("XMLHttpRequest",XMLHttpRequestProto) 00041 IMPLEMENT_PROTOFUNC_DOM(XMLHttpRequestProtoFunc) 00042 IMPLEMENT_PROTOTYPE(XMLHttpRequestProto,XMLHttpRequestProtoFunc) 00043 00044 namespace KJS { 00045 00046 XMLHttpRequestConstructorImp::XMLHttpRequestConstructorImp(ExecState *, const DOM::Document &d) 00047 : ObjectImp(), doc(d) 00048 { 00049 } 00050 00051 bool XMLHttpRequestConstructorImp::implementsConstruct() const 00052 { 00053 return true; 00054 } 00055 00056 Object XMLHttpRequestConstructorImp::construct(ExecState *exec, const List &) 00057 { 00058 return Object(new XMLHttpRequest(exec, doc)); 00059 } 00060 00061 const ClassInfo XMLHttpRequest::info = { "XMLHttpRequest", 0, &XMLHttpRequestTable, 0 }; 00062 00063 /* Source for XMLHttpRequestTable. 00064 @begin XMLHttpRequestTable 6 00065 readyState XMLHttpRequest::ReadyState DontDelete|ReadOnly 00066 responseText XMLHttpRequest::ResponseText DontDelete|ReadOnly 00067 responseXML XMLHttpRequest::ResponseXML DontDelete|ReadOnly 00068 status XMLHttpRequest::Status DontDelete|ReadOnly 00069 statusText XMLHttpRequest::StatusText DontDelete|ReadOnly 00070 onreadystatechange XMLHttpRequest::Onreadystatechange DontDelete 00071 @end 00072 */ 00073 00074 Value XMLHttpRequest::tryGet(ExecState *exec, const Identifier &propertyName) const 00075 { 00076 return DOMObjectLookupGetValue<XMLHttpRequest,DOMObject>(exec, propertyName, &XMLHttpRequestTable, this); 00077 } 00078 00079 Value XMLHttpRequest::getValueProperty(ExecState *, int token) const 00080 { 00081 switch (token) { 00082 case ReadyState: 00083 return Undefined(); 00084 case ResponseText: 00085 return Undefined(); 00086 case ResponseXML: 00087 return Undefined(); 00088 case Status: 00089 return Undefined(); 00090 case StatusText: 00091 return Undefined(); 00092 case Onreadystatechange: 00093 return Null(); 00094 default: 00095 kdWarning() << "XMLHttpRequest::getValueProperty unhandled token " << token << endl; 00096 return Value(); 00097 } 00098 } 00099 00100 void XMLHttpRequest::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr) 00101 { 00102 DOMObjectLookupPut<XMLHttpRequest,DOMObject>(exec, propertyName, value, attr, &XMLHttpRequestTable, this ); 00103 } 00104 00105 void XMLHttpRequest::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/) 00106 { 00107 switch(token) { 00108 case Onreadystatechange: 00109 break; 00110 default: 00111 kdWarning() << "HTMLDocument::putValue unhandled token " << token << endl; 00112 } 00113 } 00114 00115 void XMLHttpRequest::notifyFinished(khtml::CachedObject *) 00116 { 00117 } 00118 00119 XMLHttpRequest::XMLHttpRequest(ExecState *exec, const DOM::Document &d) 00120 : DOMObject(XMLHttpRequestProto::self(exec)) 00121 { 00122 } 00123 00124 XMLHttpRequest::~XMLHttpRequest() 00125 { 00126 } 00127 00128 Value XMLHttpRequestProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args) 00129 { 00130 if (!thisObj.inherits(&XMLHttpRequest::info)) { 00131 Object err = Error::create(exec,TypeError); 00132 exec->setException(err); 00133 return err; 00134 } 00135 switch (id) { 00136 case XMLHttpRequest::Abort: 00137 return Undefined(); 00138 case XMLHttpRequest::GetAllResponseHeaders: 00139 return Undefined(); 00140 case XMLHttpRequest::GetResponseHeader: 00141 return Undefined(); 00142 case XMLHttpRequest::Open: 00143 return Undefined(); 00144 case XMLHttpRequest::Send: 00145 return Undefined(); 00146 case XMLHttpRequest::SetRequestHeader: 00147 return Undefined(); 00148 } 00149 00150 return Undefined(); 00151 } 00152 00153 } // end namespace
KDE Logo
This file is part of the documentation for khtml Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 16 17:23:48 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003