kjs Library API Documentation

date_object.h

00001 // -*- c-basic-offset: 2 -*-
00002 /*
00003  *  This file is part of the KDE libraries
00004  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with this library; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  *  $Id: date_object.h,v 1.18.2.1 2003/01/11 18:41:30 porten Exp $
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        // non-normative properties (Appendix B)
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   // helper functions
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 }; // namespace
00129 
00130 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:14 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001