]>
git.saurik.com Git - apple/javascriptcore.git/blob - kjs/date_object.h
2 * This file is part of the KDE libraries
3 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser 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.
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 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "JSWrapperObject.h"
30 struct GregorianDateTime
;
32 class FunctionPrototype
;
33 class ObjectPrototype
;
35 class DateInstance
: public JSWrapperObject
{
37 DateInstance(JSObject
*proto
);
39 bool getTime(GregorianDateTime
&, int& offset
) const;
40 bool getUTCTime(GregorianDateTime
&) const;
41 bool getTime(double& milli
, int& offset
) const;
42 bool getUTCTime(double& milli
) const;
44 virtual const ClassInfo
*classInfo() const { return &info
; }
45 static const ClassInfo info
;
51 * The initial value of Date.prototype (and thus all objects created
52 * with the Date constructor
54 class DatePrototype
: public DateInstance
{
56 DatePrototype(ExecState
*, ObjectPrototype
*);
57 virtual bool getOwnPropertySlot(ExecState
*, const Identifier
&, PropertySlot
&);
58 virtual const ClassInfo
*classInfo() const { return &info
; }
59 static const ClassInfo info
;
65 * Functions to implement all methods that are properties of the
66 * Date.prototype object
69 // Non-normative properties (Appendix B)
70 // GetYear, SetYear, ToGMTString
72 JSValue
* dateProtoFuncToString(ExecState
*, JSObject
*, const List
&);
73 JSValue
* dateProtoFuncToUTCString(ExecState
*, JSObject
*, const List
&);
74 JSValue
* dateProtoFuncToDateString(ExecState
*, JSObject
*, const List
&);
75 JSValue
* dateProtoFuncToTimeString(ExecState
*, JSObject
*, const List
&);
76 JSValue
* dateProtoFuncToLocaleString(ExecState
*, JSObject
*, const List
&);
77 JSValue
* dateProtoFuncToLocaleDateString(ExecState
*, JSObject
*, const List
&);
78 JSValue
* dateProtoFuncToLocaleTimeString(ExecState
*, JSObject
*, const List
&);
79 JSValue
* dateProtoFuncValueOf(ExecState
*, JSObject
*, const List
&);
80 JSValue
* dateProtoFuncGetTime(ExecState
*, JSObject
*, const List
&);
81 JSValue
* dateProtoFuncGetFullYear(ExecState
*, JSObject
*, const List
&);
82 JSValue
* dateProtoFuncGetUTCFullYear(ExecState
*, JSObject
*, const List
&);
83 JSValue
* dateProtoFuncToGMTString(ExecState
*, JSObject
*, const List
&);
84 JSValue
* dateProtoFuncGetMonth(ExecState
*, JSObject
*, const List
&);
85 JSValue
* dateProtoFuncGetUTCMonth(ExecState
*, JSObject
*, const List
&);
86 JSValue
* dateProtoFuncGetDate(ExecState
*, JSObject
*, const List
&);
87 JSValue
* dateProtoFuncGetUTCDate(ExecState
*, JSObject
*, const List
&);
88 JSValue
* dateProtoFuncGetDay(ExecState
*, JSObject
*, const List
&);
89 JSValue
* dateProtoFuncGetUTCDay(ExecState
*, JSObject
*, const List
&);
90 JSValue
* dateProtoFuncGetHours(ExecState
*, JSObject
*, const List
&);
91 JSValue
* dateProtoFuncGetUTCHours(ExecState
*, JSObject
*, const List
&);
92 JSValue
* dateProtoFuncGetMinutes(ExecState
*, JSObject
*, const List
&);
93 JSValue
* dateProtoFuncGetUTCMinutes(ExecState
*, JSObject
*, const List
&);
94 JSValue
* dateProtoFuncGetSeconds(ExecState
*, JSObject
*, const List
&);
95 JSValue
* dateProtoFuncGetUTCSeconds(ExecState
*, JSObject
*, const List
&);
96 JSValue
* dateProtoFuncGetMilliSeconds(ExecState
*, JSObject
*, const List
&);
97 JSValue
* dateProtoFuncGetUTCMilliseconds(ExecState
*, JSObject
*, const List
&);
98 JSValue
* dateProtoFuncGetTimezoneOffset(ExecState
*, JSObject
*, const List
&);
99 JSValue
* dateProtoFuncSetTime(ExecState
*, JSObject
*, const List
&);
100 JSValue
* dateProtoFuncSetMilliSeconds(ExecState
*, JSObject
*, const List
&);
101 JSValue
* dateProtoFuncSetUTCMilliseconds(ExecState
*, JSObject
*, const List
&);
102 JSValue
* dateProtoFuncSetSeconds(ExecState
*, JSObject
*, const List
&);
103 JSValue
* dateProtoFuncSetUTCSeconds(ExecState
*, JSObject
*, const List
&);
104 JSValue
* dateProtoFuncSetMinutes(ExecState
*, JSObject
*, const List
&);
105 JSValue
* dateProtoFuncSetUTCMinutes(ExecState
*, JSObject
*, const List
&);
106 JSValue
* dateProtoFuncSetHours(ExecState
*, JSObject
*, const List
&);
107 JSValue
* dateProtoFuncSetUTCHours(ExecState
*, JSObject
*, const List
&);
108 JSValue
* dateProtoFuncSetDate(ExecState
*, JSObject
*, const List
&);
109 JSValue
* dateProtoFuncSetUTCDate(ExecState
*, JSObject
*, const List
&);
110 JSValue
* dateProtoFuncSetMonth(ExecState
*, JSObject
*, const List
&);
111 JSValue
* dateProtoFuncSetUTCMonth(ExecState
*, JSObject
*, const List
&);
112 JSValue
* dateProtoFuncSetFullYear(ExecState
*, JSObject
*, const List
&);
113 JSValue
* dateProtoFuncSetUTCFullYear(ExecState
*, JSObject
*, const List
&);
114 JSValue
* dateProtoFuncSetYear(ExecState
*, JSObject
*, const List
&);
115 JSValue
* dateProtoFuncGetYear(ExecState
*, JSObject
*, const List
&);
120 * The initial value of the the global variable's "Date" property
122 class DateObjectImp
: public InternalFunctionImp
{
124 DateObjectImp(ExecState
*, FunctionPrototype
*, DatePrototype
*);
126 virtual bool implementsConstruct() const;
127 virtual JSObject
*construct(ExecState
*, const List
&args
);
128 virtual JSValue
*callAsFunction(ExecState
*, JSObject
*thisObj
, const List
&args
);
130 JSObject
*construct(const List
&);