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