BooleanObject.h 1.91 KB
Newer Older
1 2
/*
 *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
weinig@apple.com's avatar
weinig@apple.com committed
3
 *  Copyright (C) 2008 Apple Inc. All rights reserved.
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
mjs's avatar
mjs committed
17
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
 *
19 20
 */

darin@apple.com's avatar
darin@apple.com committed
21 22
#ifndef BooleanObject_h
#define BooleanObject_h
23

mjs's avatar
mjs committed
24
#include "JSWrapperObject.h"
25

26
namespace JSC {
27

28 29
class BooleanObject : public JSWrapperObject {
protected:
ggaren@apple.com's avatar
ggaren@apple.com committed
30 31
    JS_EXPORT_PRIVATE BooleanObject(VM&, Structure*);
    JS_EXPORT_PRIVATE void finishCreation(VM&);
32

33 34
public:
    typedef JSWrapperObject Base;
darin@apple.com's avatar
darin@apple.com committed
35

ggaren@apple.com's avatar
ggaren@apple.com committed
36
    static BooleanObject* create(VM& vm, Structure* structure)
37
    {
ggaren@apple.com's avatar
ggaren@apple.com committed
38 39
        BooleanObject* boolean = new (NotNull, allocateCell<BooleanObject>(vm.heap)) BooleanObject(vm, structure);
        boolean->finishCreation(vm);
40 41 42
        return boolean;
    }
        
43
    DECLARE_EXPORT_INFO;
44
        
ggaren@apple.com's avatar
ggaren@apple.com committed
45
    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
darin@apple.com's avatar
darin@apple.com committed
46
    {
47
        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
darin@apple.com's avatar
darin@apple.com committed
48
    }
49 50 51 52 53 54
};

BooleanObject* asBooleanObject(JSValue);

inline BooleanObject* asBooleanObject(JSValue value)
{
55
    ASSERT(asObject(value)->inherits(BooleanObject::info()));
56 57
    return static_cast<BooleanObject*>(asObject(value));
}
darin@apple.com's avatar
darin@apple.com committed
58

59
} // namespace JSC
60

darin@apple.com's avatar
darin@apple.com committed
61
#endif // BooleanObject_h