#ifndef _DATE_OBJECT_H_
#define _DATE_OBJECT_H_
#include "internal.h"
#include "function_object.h"
#include <sys/time.h>
namespace KJS {
class DateInstanceImp : public ObjectImp {
public:
DateInstanceImp(ObjectImp *proto);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
};
class DatePrototypeImp : public DateInstanceImp {
public:
DatePrototypeImp(ExecState *exec, ObjectPrototypeImp *objectProto);
Value get(ExecState *exec, const Identifier &p) const;
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
};
class DateProtoFuncImp : public InternalFunctionImp {
public:
DateProtoFuncImp(ExecState *exec, int i, int len);
virtual bool implementsCall() const;
virtual Value call(ExecState *exec, Object &thisObj, const List &args);
Completion execute(const List &);
enum { ToString, ToDateString, ToTimeString, ToLocaleString,
ToLocaleDateString, ToLocaleTimeString, ValueOf, GetTime,
GetFullYear, GetMonth, GetDate, GetDay, GetHours, GetMinutes,
GetSeconds, GetMilliSeconds, GetTimezoneOffset, SetTime,
SetMilliSeconds, SetSeconds, SetMinutes, SetHours, SetDate,
SetMonth, SetFullYear, ToUTCString,
GetYear, SetYear, ToGMTString };
private:
int id;
bool utc;
};
class DateObjectImp : public InternalFunctionImp {
public:
DateObjectImp(ExecState *exec,
FunctionPrototypeImp *funcProto,
DatePrototypeImp *dateProto);
virtual bool implementsConstruct() const;
virtual Object construct(ExecState *exec, const List &args);
virtual bool implementsCall() const;
virtual Value call(ExecState *exec, Object &thisObj, const List &args);
Completion execute(const List &);
Object construct(const List &);
};
class DateObjectFuncImp : public InternalFunctionImp {
public:
DateObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto,
int i, int len);
virtual bool implementsCall() const;
virtual Value call(ExecState *exec, Object &thisObj, const List &args);
enum { Parse, UTC };
private:
int id;
};
double parseDate(const UString &u);
time_t KRFCDate_parseDate(const UString &_date);
double timeClip(double);
};
#endif