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 #include <sys/time.h>
00029 
00030 namespace KJS {
00031 
00032   class DateInstanceImp : public ObjectImp {
00033   public:
00034     DateInstanceImp(ObjectImp *proto);
00035 
00036     virtual const ClassInfo *classInfo() const { return &info; }
00037     static const ClassInfo info;
00038   };
00039 
00046   class DatePrototypeImp : public DateInstanceImp {
00047   public:
00048     DatePrototypeImp(ExecState *exec, ObjectPrototypeImp *objectProto);
00049     Value get(ExecState *exec, const Identifier &p) const;
00050     virtual const ClassInfo *classInfo() const { return &info; }
00051     static const ClassInfo info;
00052   };
00053 
00060   class DateProtoFuncImp : public InternalFunctionImp {
00061   public:
00062     DateProtoFuncImp(ExecState *exec, int i, int len);
00063 
00064     virtual bool implementsCall() const;
00065     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00066 
00067 
00068     Completion execute(const List &);
00069     enum { ToString, ToDateString, ToTimeString, ToLocaleString,
00070        ToLocaleDateString, ToLocaleTimeString, ValueOf, GetTime,
00071        GetFullYear, GetMonth, GetDate, GetDay, GetHours, GetMinutes,
00072        GetSeconds, GetMilliSeconds, GetTimezoneOffset, SetTime,
00073        SetMilliSeconds, SetSeconds, SetMinutes, SetHours, SetDate,
00074        SetMonth, SetFullYear, ToUTCString,
00075        
00076        GetYear, SetYear, ToGMTString };
00077   private:
00078     int id;
00079     bool utc;
00080   };
00081 
00087   class DateObjectImp : public InternalFunctionImp {
00088   public:
00089     DateObjectImp(ExecState *exec,
00090                   FunctionPrototypeImp *funcProto,
00091                   DatePrototypeImp *dateProto);
00092 
00093     virtual bool implementsConstruct() const;
00094     virtual Object construct(ExecState *exec, const List &args);
00095     virtual bool implementsCall() const;
00096     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00097 
00098     Completion execute(const List &);
00099     Object construct(const List &);
00100   };
00101 
00108   class DateObjectFuncImp : public InternalFunctionImp {
00109   public:
00110     DateObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto,
00111                       int i, int len);
00112 
00113     virtual bool implementsCall() const;
00114     virtual Value call(ExecState *exec, Object &thisObj, const List &args);
00115 
00116     enum { Parse, UTC };
00117   private:
00118     int id;
00119   };
00120 
00121   
00122   Value parseDate(const UString &u);
00123   double KRFCDate_parseDate(const UString &_date);
00124   Value timeClip(const Value &t);
00125   int local_timeoffset();
00126 
00127 } 
00128 
00129 #endif