webengine/osswebengine/DerivedSources/WebCore/JSEntity.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2     This file is part of the WebKit open source project.
       
     3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library is distributed in the hope that it will be useful,
       
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #include "config.h"
       
    22 
       
    23 #include "JSEntity.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "Entity.h"
       
    28 #include "PlatformString.h"
       
    29 
       
    30 using namespace KJS;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 /* Hash table */
       
    35 
       
    36 static const HashEntry JSEntityTableEntries[] =
       
    37 {
       
    38     { 0, 0, 0, 0, 0 },
       
    39     { "notationName", JSEntity::NotationNameAttrNum, DontDelete|ReadOnly, 0, &JSEntityTableEntries[5] },
       
    40     { "publicId", JSEntity::PublicIdAttrNum, DontDelete|ReadOnly, 0, &JSEntityTableEntries[4] },
       
    41     { 0, 0, 0, 0, 0 },
       
    42     { "systemId", JSEntity::SystemIdAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    43     { "constructor", JSEntity::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    44 };
       
    45 
       
    46 static const HashTable JSEntityTable = 
       
    47 {
       
    48     2, 6, JSEntityTableEntries, 4
       
    49 };
       
    50 
       
    51 /* Hash table for constructor */
       
    52 
       
    53 static const HashEntry JSEntityConstructorTableEntries[] =
       
    54 {
       
    55     { 0, 0, 0, 0, 0 }
       
    56 };
       
    57 
       
    58 static const HashTable JSEntityConstructorTable = 
       
    59 {
       
    60     2, 1, JSEntityConstructorTableEntries, 1
       
    61 };
       
    62 
       
    63 class JSEntityConstructor : public DOMObject {
       
    64 public:
       
    65     JSEntityConstructor(ExecState* exec)
       
    66     {
       
    67         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    68         putDirect(exec->propertyNames().prototype, JSEntityPrototype::self(exec), None);
       
    69     }
       
    70     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    71     JSValue* getValueProperty(ExecState*, int token) const;
       
    72     virtual const ClassInfo* classInfo() const { return &info; }
       
    73     static const ClassInfo info;
       
    74 
       
    75     virtual bool implementsHasInstance() const { return true; }
       
    76 };
       
    77 
       
    78 const ClassInfo JSEntityConstructor::info = { "EntityConstructor", 0, &JSEntityConstructorTable, 0 };
       
    79 
       
    80 bool JSEntityConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    81 {
       
    82     return getStaticValueSlot<JSEntityConstructor, DOMObject>(exec, &JSEntityConstructorTable, this, propertyName, slot);
       
    83 }
       
    84 
       
    85 JSValue* JSEntityConstructor::getValueProperty(ExecState*, int token) const
       
    86 {
       
    87     // The token is the numeric value of its associated constant
       
    88     return jsNumber(token);
       
    89 }
       
    90 
       
    91 /* Hash table for prototype */
       
    92 
       
    93 static const HashEntry JSEntityPrototypeTableEntries[] =
       
    94 {
       
    95     { 0, 0, 0, 0, 0 }
       
    96 };
       
    97 
       
    98 static const HashTable JSEntityPrototypeTable = 
       
    99 {
       
   100     2, 1, JSEntityPrototypeTableEntries, 1
       
   101 };
       
   102 
       
   103 const ClassInfo JSEntityPrototype::info = { "EntityPrototype", 0, &JSEntityPrototypeTable, 0 };
       
   104 
       
   105 JSObject* JSEntityPrototype::self(ExecState* exec)
       
   106 {
       
   107     return KJS::cacheGlobalObject<JSEntityPrototype>(exec, "[[JSEntity.prototype]]");
       
   108 }
       
   109 
       
   110 const ClassInfo JSEntity::info = { "Entity", &JSNode::info, &JSEntityTable, 0 };
       
   111 
       
   112 JSEntity::JSEntity(ExecState* exec, Entity* impl)
       
   113     : JSNode(exec, impl)
       
   114 {
       
   115     setPrototype(JSEntityPrototype::self(exec));
       
   116 }
       
   117 
       
   118 bool JSEntity::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   119 {
       
   120     return getStaticValueSlot<JSEntity, JSNode>(exec, &JSEntityTable, this, propertyName, slot);
       
   121 }
       
   122 
       
   123 JSValue* JSEntity::getValueProperty(ExecState* exec, int token) const
       
   124 {
       
   125     switch (token) {
       
   126     case PublicIdAttrNum: {
       
   127         Entity* imp = static_cast<Entity*>(impl());
       
   128 
       
   129         return jsStringOrNull(imp->publicId());
       
   130     }
       
   131     case SystemIdAttrNum: {
       
   132         Entity* imp = static_cast<Entity*>(impl());
       
   133 
       
   134         return jsStringOrNull(imp->systemId());
       
   135     }
       
   136     case NotationNameAttrNum: {
       
   137         Entity* imp = static_cast<Entity*>(impl());
       
   138 
       
   139         return jsStringOrNull(imp->notationName());
       
   140     }
       
   141     case ConstructorAttrNum:
       
   142         return getConstructor(exec);
       
   143     }
       
   144     return 0;
       
   145 }
       
   146 
       
   147 JSValue* JSEntity::getConstructor(ExecState* exec)
       
   148 {
       
   149     return KJS::cacheGlobalObject<JSEntityConstructor>(exec, "[[Entity.constructor]]");
       
   150 }
       
   151 
       
   152 }