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 |
|
---|
26 | namespace JSC {
|
---|
27 |
|
---|
28 | struct GregorianDateTime;
|
---|
29 |
|
---|
30 | class DateInstance : public JSWrapperObject {
|
---|
31 | public:
|
---|
32 | explicit DateInstance(PassRefPtr<StructureID>);
|
---|
33 | virtual ~DateInstance();
|
---|
34 |
|
---|
35 | double internalNumber() const { return internalValue()->uncheckedGetNumber(); }
|
---|
36 |
|
---|
37 | bool getTime(GregorianDateTime&, int& offset) const;
|
---|
38 | bool getUTCTime(GregorianDateTime&) const;
|
---|
39 | bool getTime(double& milliseconds, int& offset) const;
|
---|
40 | bool getUTCTime(double& milliseconds) const;
|
---|
41 |
|
---|
42 | static const ClassInfo info;
|
---|
43 |
|
---|
44 | void msToGregorianDateTime(double, bool outputIsUTC, GregorianDateTime&) const;
|
---|
45 |
|
---|
46 | private:
|
---|
47 | virtual const ClassInfo* classInfo() const { return &info; }
|
---|
48 |
|
---|
49 | using JSWrapperObject::internalValue;
|
---|
50 |
|
---|
51 | struct Cache;
|
---|
52 | mutable Cache* m_cache;
|
---|
53 | };
|
---|
54 |
|
---|
55 | DateInstance* asDateInstance(JSValuePtr);
|
---|
56 |
|
---|
57 | inline DateInstance* asDateInstance(JSValuePtr value)
|
---|
58 | {
|
---|
59 | ASSERT(asObject(value)->inherits(&DateInstance::info));
|
---|
60 | return static_cast<DateInstance*>(asObject(value));
|
---|
61 | }
|
---|
62 |
|
---|
63 | } // namespace JSC
|
---|
64 |
|
---|
65 | #endif // DateInstance_h
|
---|