Ignore:
Timestamp:
Mar 21, 2002, 4:31:57 PM (23 years ago)
Author:
mjs
Message:

Merged changes from LABYRINTH_KDE_3_MERGE branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/date_object.h

    r6 r798  
     1// -*- c-basic-offset: 2 -*-
    12/*
    23 *  This file is part of the KDE libraries
     
    1617 *  License along with this library; if not, write to the Free Software
    1718 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     19 *
     20 *  $Id$
    1821 */
    1922
     
    2124#define _DATE_OBJECT_H_
    2225
    23 #include "object.h"
    24 #include "function.h"
     26#include "internal.h"
     27#include "function_object.h"
    2528
    2629namespace KJS {
    2730
    28   class DateObject : public ConstructorImp {
     31  class DateInstanceImp : public ObjectImp {
    2932  public:
    30     DateObject(const Object& funcProto, const Object &dateProto);
     33    DateInstanceImp(const Object &proto);
     34
     35    virtual const ClassInfo *classInfo() const { return &info; }
     36    static const ClassInfo info;
     37  };
     38
     39  /**
     40   * @internal
     41   *
     42   * The initial value of Date.prototype (and thus all objects created
     43   * with the Date constructor
     44   */
     45  class DatePrototypeImp : public DateInstanceImp {
     46  public:
     47    DatePrototypeImp(ExecState *exec, ObjectPrototypeImp *objectProto);
     48    Value get(ExecState *exec, const UString &p) const;
     49    virtual const ClassInfo *classInfo() const { return &info; }
     50    static const ClassInfo info;
     51  };
     52
     53  /**
     54   * @internal
     55   *
     56   * Class to implement all methods that are properties of the
     57   * Date.prototype object
     58   */
     59  class DateProtoFuncImp : public InternalFunctionImp {
     60  public:
     61    DateProtoFuncImp(ExecState *exec, int i, int len);
     62
     63    virtual bool implementsCall() const;
     64    virtual Value call(ExecState *exec, Object &thisObj, const List &args);
     65
     66
     67    Completion execute(const List &);
     68    enum { ToString, ToDateString, ToTimeString, ToLocaleString,
     69           ToLocaleDateString, ToLocaleTimeString, ValueOf, GetTime,
     70           GetFullYear, GetMonth, GetDate, GetDay, GetHours, GetMinutes,
     71           GetSeconds, GetMilliSeconds, GetTimezoneOffset, SetTime,
     72           SetMilliSeconds, SetSeconds, SetMinutes, SetHours, SetDate,
     73           SetMonth, SetFullYear, ToUTCString,
     74           // non-normative properties (Appendix B)
     75           GetYear, SetYear, ToGMTString };
     76  private:
     77    int id;
     78    bool utc;
     79  };
     80
     81  /**
     82   * @internal
     83   *
     84   * The initial value of the the global variable's "Date" property
     85   */
     86  class DateObjectImp : public InternalFunctionImp {
     87  public:
     88    DateObjectImp(ExecState *exec,
     89                  FunctionPrototypeImp *funcProto,
     90                  DatePrototypeImp *dateProto);
     91
     92    virtual bool implementsConstruct() const;
     93    virtual Object construct(ExecState *exec, const List &args);
     94    virtual bool implementsCall() const;
     95    virtual Value call(ExecState *exec, Object &thisObj, const List &args);
     96
    3197    Completion execute(const List &);
    3298    Object construct(const List &);
    33     KJSO get(const UString &p) const;
    3499  };
    35100
    36   class DatePrototype : public ObjectImp {
     101  /**
     102   * @internal
     103   *
     104   * Class to implement all methods that are properties of the
     105   * Date object
     106   */
     107  class DateObjectFuncImp : public InternalFunctionImp {
    37108  public:
    38     DatePrototype(const Object& proto);
    39     virtual KJSO get(const UString &p) const;
     109    DateObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto,
     110                      int i, int len);
     111
     112    virtual bool implementsCall() const;
     113    virtual Value call(ExecState *exec, Object &thisObj, const List &args);
     114
     115    enum { Parse, UTC };
     116  private:
     117    int id;
    40118  };
     119
     120  // helper functions
     121  Value parseDate(const String &s);
     122  time_t KRFCDate_parseDate(const UString &_date);
     123  Value timeClip(const Value &t);
    41124
    42125}; // namespace
Note: See TracChangeset for help on using the changeset viewer.