/src/node/deps/v8/include/v8-date.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2021 the V8 project authors. All rights reserved. |
2 | | // Use of this source code is governed by a BSD-style license that can be |
3 | | // found in the LICENSE file. |
4 | | |
5 | | #ifndef INCLUDE_V8_DATE_H_ |
6 | | #define INCLUDE_V8_DATE_H_ |
7 | | |
8 | | #include "v8-local-handle.h" // NOLINT(build/include_directory) |
9 | | #include "v8-object.h" // NOLINT(build/include_directory) |
10 | | #include "v8config.h" // NOLINT(build/include_directory) |
11 | | |
12 | | namespace v8 { |
13 | | |
14 | | class Context; |
15 | | |
16 | | /** |
17 | | * An instance of the built-in Date constructor (ECMA-262, 15.9). |
18 | | */ |
19 | | class V8_EXPORT Date : public Object { |
20 | | public: |
21 | | static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context, |
22 | | double time); |
23 | | |
24 | | /** |
25 | | * A specialization of Value::NumberValue that is more efficient |
26 | | * because we know the structure of this object. |
27 | | */ |
28 | | double ValueOf() const; |
29 | | |
30 | | /** |
31 | | * Generates ISO string representation. |
32 | | */ |
33 | | v8::Local<v8::String> ToISOString() const; |
34 | | |
35 | 0 | V8_INLINE static Date* Cast(Value* value) { |
36 | 0 | #ifdef V8_ENABLE_CHECKS |
37 | 0 | CheckCast(value); |
38 | 0 | #endif |
39 | 0 | return static_cast<Date*>(value); |
40 | 0 | } |
41 | | |
42 | | private: |
43 | | static void CheckCast(Value* obj); |
44 | | }; |
45 | | |
46 | | } // namespace v8 |
47 | | |
48 | | #endif // INCLUDE_V8_DATE_H_ |