v8-date.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef INCLUDE_V8_DATE_H_
  5. #define INCLUDE_V8_DATE_H_
  6. #include "v8-local-handle.h" // NOLINT(build/include_directory)
  7. #include "v8-object.h" // NOLINT(build/include_directory)
  8. #include "v8config.h" // NOLINT(build/include_directory)
  9. namespace v8 {
  10. class Context;
  11. /**
  12. * An instance of the built-in Date constructor (ECMA-262, 15.9).
  13. */
  14. class V8_EXPORT Date : public Object {
  15. public:
  16. static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
  17. double time);
  18. /**
  19. * A specialization of Value::NumberValue that is more efficient
  20. * because we know the structure of this object.
  21. */
  22. double ValueOf() const;
  23. V8_INLINE static Date* Cast(Value* value) {
  24. #ifdef V8_ENABLE_CHECKS
  25. CheckCast(value);
  26. #endif
  27. return static_cast<Date*>(value);
  28. }
  29. private:
  30. static void CheckCast(Value* obj);
  31. };
  32. } // namespace v8
  33. #endif // INCLUDE_V8_DATE_H_