File indexing completed on 2024-05-12 15:43:26

0001 /*
0002  *  This file is part of the KDE libraries
0003  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
0004  *
0005  *  This library is free software; you can redistribute it and/or
0006  *  modify it under the terms of the GNU Lesser General Public
0007  *  License as published by the Free Software Foundation; either
0008  *  version 2 of the License, or (at your option) any later version.
0009  *
0010  *  This library is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  *  Lesser General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU Lesser General Public
0016  *  License along with this library; if not, write to the Free Software
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  *
0019  */
0020 
0021 #ifndef MATH_OBJECT_H_
0022 #define MATH_OBJECT_H_
0023 
0024 #include "function_object.h"
0025 
0026 namespace KJS
0027 {
0028 
0029 class MathObjectImp : public JSObject
0030 {
0031 public:
0032     MathObjectImp(ExecState *exec,
0033                   ObjectPrototype *objProto);
0034     using KJS::JSObject::getOwnPropertySlot;
0035     bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot &) override;
0036     JSValue *getValueProperty(ExecState *exec, int token) const;
0037     const ClassInfo *classInfo() const override
0038     {
0039         return &info;
0040     }
0041     static const ClassInfo info;
0042     enum { Euler, Ln2, Ln10, Log2E, Log10E, Pi, Sqrt1_2, Sqrt2,
0043            Abs, ACos, ASin, ATan, ATan2, Ceil, Cos, Pow,
0044            Exp, Floor, Log, Max, Min, Random, Round, Sin, Sqrt, Tan,
0045            //ES6 (draft 08.11.2013)
0046            ACosH, ASinH, ATanH, Cbrt, CosH, Exmp1,
0047            Log1p, Log10, Log2, Sign, SinH, TanH, Trunc,
0048            Hypot, Imul, FRound, Clz32
0049          };
0050 };
0051 
0052 class MathFuncImp : public InternalFunctionImp
0053 {
0054 public:
0055     MathFuncImp(ExecState *exec, int i, int l, const Identifier &);
0056     JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args) override;
0057 private:
0058     int id;
0059 };
0060 
0061 } // namespace
0062 
0063 #endif