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"
31 class FunctionPrototype
;
32 class ObjectPrototype
;
34 class DateInstance
: public JSWrapperObject
{
36 DateInstance(JSObject
*proto
);
38 bool getTime(tm
&t
, int &gmtoffset
) const;
39 bool getUTCTime(tm
&t
) const;
40 bool getTime(double &ms
, int &gmtoffset
) const;
41 bool getUTCTime(double &ms
) const;
43 virtual const ClassInfo
*classInfo() const { return &info
; }
44 static const ClassInfo info
;
50 * The initial value of Date.prototype (and thus all objects created
51 * with the Date constructor
53 class DatePrototype
: public DateInstance
{
55 DatePrototype(ExecState
*, ObjectPrototype
*);
56 virtual bool getOwnPropertySlot(ExecState
*, const Identifier
&, PropertySlot
&);
57 virtual const ClassInfo
*classInfo() const { return &info
; }
58 static const ClassInfo info
;
64 * Class to implement all methods that are properties of the
65 * Date.prototype object
67 class DateProtoFunc
: public InternalFunctionImp
{
69 DateProtoFunc(ExecState
*, int i
, int len
, const Identifier
& date
);
71 virtual JSValue
*callAsFunction(ExecState
*, JSObject
*thisObj
, const List
&args
);
73 enum { ToString
, ToDateString
, ToTimeString
, ToLocaleString
,
74 ToLocaleDateString
, ToLocaleTimeString
, ValueOf
, GetTime
,
75 GetFullYear
, GetMonth
, GetDate
, GetDay
, GetHours
, GetMinutes
,
76 GetSeconds
, GetMilliSeconds
, GetTimezoneOffset
, SetTime
,
77 SetMilliSeconds
, SetSeconds
, SetMinutes
, SetHours
, SetDate
,
78 SetMonth
, SetFullYear
, ToUTCString
,
79 // non-normative properties (Appendix B)
80 GetYear
, SetYear
, ToGMTString
};
89 * The initial value of the global variable's "Date" property
91 class DateObjectImp
: public InternalFunctionImp
{
92 using InternalFunctionImp::construct
;
94 DateObjectImp(ExecState
*, FunctionPrototype
*, DatePrototype
*);
96 virtual bool implementsConstruct() const;
97 virtual JSObject
*construct(ExecState
*, const List
&args
);
98 virtual JSValue
*callAsFunction(ExecState
*, JSObject
*thisObj
, const List
&args
);
100 Completion
execute(const List
&);
101 JSObject
*construct(const List
&);