File indexing completed on 2024-03-17 15:24:29

0001 /***************************************************************************
0002  * interpreter.h
0003  * This file is part of the KDE project
0004  * copyright (C)2007-2008 by Sebastian Sauer (mail@dipe.org)
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  * This program 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  * Library General Public License for more details.
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this program; see the file COPYING.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  ***************************************************************************/
0019 
0020 #ifndef KROSS_QTS_INTERPRETER_H
0021 #define KROSS_QTS_INTERPRETER_H
0022 
0023 #include <kross/core/krossconfig.h>
0024 #include <kross/core/interpreter.h>
0025 #include <kross/core/script.h>
0026 #include <kross/core/action.h>
0027 
0028 namespace Kross
0029 {
0030 
0031 class EcmaScript;
0032 
0033 /**
0034 * The EcmaInterpreter class implements a \a Kross::Interpreter to provide
0035 * a factory for \a EcmaScript instances. The interpreter is a singleton
0036 * managed by Kross to share information between different script instances.
0037 */
0038 class EcmaInterpreter : public Kross::Interpreter
0039 {
0040     friend class EcmaScript;
0041 public:
0042 
0043     /**
0044     * Constructor.
0045     *
0046     * \param info The \a Kross::InterpreterInfo instance that
0047     * describes this interpreter.
0048     */
0049     explicit EcmaInterpreter(Kross::InterpreterInfo *info);
0050 
0051     /**
0052     * Destructor.
0053     */
0054     ~EcmaInterpreter() override;
0055 
0056     /**
0057     * Factory method to create a new \a EcmaScript instance.
0058     *
0059     * \param action The \a Kross::Action instance that decorates
0060     * the script and contains details like the scripting code.
0061     * \return a new \a EcmaScript instance.
0062     */
0063     Kross::Script *createScript(Kross::Action *action) override;
0064 
0065 private:
0066     class Private;
0067     Private *const d;
0068 };
0069 
0070 }
0071 
0072 #endif