KJS

date_object.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 1999-2000 Harri Porten ([email protected])
4  *
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.
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  * Lesser General Public License for more details.
14  *
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
18  *
19  */
20 
21 #ifndef DATE_OBJECT_H
22 #define DATE_OBJECT_H
23 
24 #include "function.h"
25 #include "JSWrapperObject.h"
26 
27 struct tm;
28 
29 namespace KJS
30 {
31 
32 class FunctionPrototype;
33 class ObjectPrototype;
34 
35 class DateInstance : public JSWrapperObject
36 {
37 public:
38  DateInstance(JSObject *proto);
39 
40  bool getTime(tm &t, int &gmtoffset) const;
41  bool getUTCTime(tm &t) const;
42  bool getTime(double &ms, int &gmtoffset) const;
43  bool getUTCTime(double &ms) const;
44 
45  virtual const ClassInfo *classInfo() const
46  {
47  return &info;
48  }
49  static const ClassInfo info;
50 
51  virtual JSObject *valueClone(Interpreter *targetCtx) const;
52 };
53 
60 class DatePrototype : public DateInstance
61 {
62 public:
64  using KJS::JSObject::getOwnPropertySlot;
65  virtual bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot &);
66  virtual const ClassInfo *classInfo() const
67  {
68  return &info;
69  }
70  static const ClassInfo info;
71 };
72 
79 class DateProtoFunc : public InternalFunctionImp
80 {
81 public:
82  DateProtoFunc(ExecState *, int i, int len, const Identifier &date);
83 
84  virtual JSValue *callAsFunction(ExecState *, JSObject *thisObj, const List &args);
85 
86  enum { ToString, ToDateString, ToTimeString, ToLocaleString,
87  ToLocaleDateString, ToLocaleTimeString, ValueOf, GetTime,
88  GetFullYear, GetMonth, GetDate, GetDay, GetHours, GetMinutes,
89  GetSeconds, GetMilliSeconds, GetTimezoneOffset, SetTime,
90  SetMilliSeconds, SetSeconds, SetMinutes, SetHours, SetDate,
91  SetMonth, SetFullYear, ToUTCString, ToISOString, ToJSON,
92  // non-normative properties (Appendix B)
93  GetYear, SetYear, ToGMTString
94  };
95 private:
96  short id;
97  bool utc;
98 };
99 
105 class DateObjectImp : public InternalFunctionImp
106 {
107  using InternalFunctionImp::construct;
108 public:
110 
111  virtual bool implementsConstruct() const;
112  virtual JSObject *construct(ExecState *, const List &args);
113  virtual JSValue *callAsFunction(ExecState *, JSObject *thisObj, const List &args);
114 
115  Completion execute(const List &);
116  JSObject *construct(const List &);
117 };
118 
119 } // namespace
120 
121 #endif
JSValue is the base type for all primitives (Undefined, Null, Boolean, String, Number) and objects in...
Definition: value.h:58
Completion objects are used to convey the return status and value from functions. ...
Definition: completion.h:52
Native list type.
Definition: list.h:52
Class Information.
Definition: object.h:48
Represents the current state of script execution.
Definition: ExecState.h:53
Represents an Identifier for a Javascript object.
Definition: identifier.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jan 14 2021 23:02:06 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.