NumberObject.h 557 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Runtime/Object.h>
  8. namespace JS {
  9. class NumberObject : public Object {
  10. JS_OBJECT(NumberObject, Object);
  11. JS_DECLARE_ALLOCATOR(NumberObject);
  12. public:
  13. static NonnullGCPtr<NumberObject> create(Realm&, double);
  14. virtual ~NumberObject() override = default;
  15. double number() const { return m_value; }
  16. protected:
  17. NumberObject(double, Object& prototype);
  18. private:
  19. double m_value { 0 };
  20. };
  21. }