source: webkit/trunk/JavaScriptCore/runtime/DateInstance.h@ 49886

Last change on this file since 49886 was 49886, checked in by [email protected], 16 years ago

Refactored DateInstance::msToGregorianDateTime so that a DateInstance's
caller doesn't need to supply the DateInstance's own internal value to
the DateInstance.

Patch by Geoffrey Garen <[email protected]> on 2009-10-20
Reviewed by Sam Weinig.

  • runtime/DateInstance.cpp:

(JSC::DateInstance::getGregorianDateTime): Renamed from "msToGregorianDateTime".

  • runtime/DateInstance.h:
  • runtime/DatePrototype.cpp:

(JSC::formatLocaleDate):
(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncToLocaleString):
(JSC::dateProtoFuncToLocaleDateString):
(JSC::dateProtoFuncToLocaleTimeString):
(JSC::dateProtoFuncGetTime):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncToGMTString):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear): Also renamed "utc" to "outputIsUTC", for clarity.

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2008 Apple Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef DateInstance_h
22#define DateInstance_h
23
24#include "JSWrapperObject.h"
25
26namespace WTF {
27 struct GregorianDateTime;
28}
29
30namespace JSC {
31
32 class DateInstance : public JSWrapperObject {
33 public:
34 DateInstance(ExecState*, double);
35 explicit DateInstance(NonNullPassRefPtr<Structure>);
36 virtual ~DateInstance();
37
38 double internalNumber() const { return internalValue().uncheckedGetNumber(); }
39
40 bool getTime(WTF::GregorianDateTime&, int& offset) const;
41 bool getUTCTime(WTF::GregorianDateTime&) const;
42 bool getTime(double& milliseconds, int& offset) const;
43 bool getUTCTime(double& milliseconds) const;
44
45 static JS_EXPORTDATA const ClassInfo info;
46
47 bool getGregorianDateTime(bool outputIsUTC, WTF::GregorianDateTime&) const;
48
49 static PassRefPtr<Structure> createStructure(JSValue prototype)
50 {
51 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
52 }
53
54 protected:
55 static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
56
57 private:
58 virtual const ClassInfo* classInfo() const { return &info; }
59
60
61 struct Cache;
62 mutable Cache* m_cache;
63 };
64
65 DateInstance* asDateInstance(JSValue);
66
67 inline DateInstance* asDateInstance(JSValue value)
68 {
69 ASSERT(asObject(value)->inherits(&DateInstance::info));
70 return static_cast<DateInstance*>(asObject(value));
71 }
72
73} // namespace JSC
74
75#endif // DateInstance_h
Note: See TracBrowser for help on using the repository browser.