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 */ 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 // non-normative properties (Appendix B) 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 // helper functions 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 } // namespace 00128 00129 #endif
KDE Logo
This file is part of the documentation for kjs Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:48:57 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003