00001 00006 /* 00007 MUnDoCAAD MUD Engine 00008 Copyright (C) 2002-2005 José Manuel Ferrer Ortiz 00009 00010 ***************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify it * 00013 * under the terms of the GNU General Public License version 2, as * 00014 * published by the Free Software Foundation. * 00015 * * 00016 * This program is distributed in the hope that it will be useful, but * 00017 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00019 * General Public License version 2 for more details. * 00020 * * 00021 * You should have received a copy of the GNU General Public License * 00022 * version 2 along with this program; if not, write to the Free Software * 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00024 * * 00025 ***************************************************************************** 00026 */ 00027 00028 00029 #include <QDir> 00030 00031 #include "Ejecutor.hpp" 00032 00033 00034 extern QDir dir_datos; 00035 00036 00038 Ejecutor::Ejecutor () 00039 { 00040 QFile fichero (dir_datos.filePath ("libreria.qs")); 00041 00042 if (!fichero.open (QIODevice::ReadOnly | QIODevice::Text)) 00043 // No se ha podido abrir el archivo 00044 qFatal ("\"%s\": %s", fichero.fileName().toLatin1().constData(), 00045 fichero.errorString().toLatin1().constData()); 00046 00047 interprete.evaluate (fichero.readAll(), 0, fichero.fileName()); 00048 interprete.addTransientObject (&librero); 00049 } 00050 00052 Ejecutor::~Ejecutor () 00053 { 00054 qDebug ("Destructor de Ejecutor"); 00055 } 00056 00058 void Ejecutor::Ejecuta (const QString &codigo, const QString &funcion) 00059 { 00060 interprete.evaluate (codigo, new QObject, funcion); 00061 }
1.4.4