00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _DATE_OBJECT_H_
00023 #define _DATE_OBJECT_H_
00024
00025 #include "internal.h"
00026 #include "function_object.h"
00027
00028 namespace KJS {
00029
00030 class DateInstanceImp : public ObjectImp {
00031 public:
00032 DateInstanceImp(ObjectImp *proto);
00033
00034 virtual const ClassInfo *classInfo() const { return &info; }
00035 static const ClassInfo info;
00036 };
00037
00044 class DatePrototypeImp : public DateInstanceImp {
00045 public:
00046 DatePrototypeImp(ExecState *exec, ObjectPrototypeImp *objectProto);
00047 Value get(ExecState *exec, const Identifier &p) const;
00048 virtual const ClassInfo *classInfo() const { return &info; }
00049 static const ClassInfo info;
00050 };
00051
00058 class DateProtoFuncImp : public InternalFunctionImp {
00059 public:
00060 DateProtoFuncImp(ExecState *exec, int i, int len);
00061
00062 virtual bool implementsCall() const;
00063 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00064
00065
00066 Completion execute(const List &);
00067 enum { ToString, ToDateString, ToTimeString, ToLocaleString,
00068 ToLocaleDateString, ToLocaleTimeString, ValueOf, GetTime,
00069 GetFullYear, GetMonth, GetDate, GetDay, GetHours, GetMinutes,
00070 GetSeconds, GetMilliSeconds, GetTimezoneOffset, SetTime,
00071 SetMilliSeconds, SetSeconds, SetMinutes, SetHours, SetDate,
00072 SetMonth, SetFullYear, ToUTCString,
00073
00074 GetYear, SetYear, ToGMTString };
00075 private:
00076 int id;
00077 bool utc;
00078 };
00079
00085 class DateObjectImp : public InternalFunctionImp {
00086 public:
00087 DateObjectImp(ExecState *exec,
00088 FunctionPrototypeImp *funcProto,
00089 DatePrototypeImp *dateProto);
00090
00091 virtual bool implementsConstruct() const;
00092 virtual Object construct(ExecState *exec, const List &args);
00093 virtual bool implementsCall() const;
00094 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00095
00096 Completion execute(const List &);
00097 Object construct(const List &);
00098 };
00099
00106 class DateObjectFuncImp : public InternalFunctionImp {
00107 public:
00108 DateObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto,
00109 int i, int len);
00110
00111 virtual bool implementsCall() const;
00112 virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00113
00114 enum { Parse, UTC };
00115 private:
00116 int id;
00117 };
00118
00119
00120 double parseDate(const UString &u);
00121 double KRFCDate_parseDate(const UString &_date);
00122 double timeClip(double t);
00123 double makeTime(struct tm *t, double milli, bool utc);
00124
00125 }
00126
00127 #endif