[rkward-cvs] SF.net SVN: rkward: [1897] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu May 10 17:33:40 UTC 2007
Revision: 1897
http://svn.sourceforge.net/rkward/?rev=1897&view=rev
Author: tfry
Date: 2007-05-10 10:33:39 -0700 (Thu, 10 May 2007)
Log Message:
-----------
Add very ugly hack to make color_chooser faster
Modified Paths:
--------------
trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
trunk/rkward/rkward/plugins/plots/color_chooser.xml
trunk/rkward/rkward/scriptbackends/Makefile.am
trunk/rkward/rkward/scriptbackends/phpbackend.cpp
trunk/rkward/rkward/scriptbackends/phpbackend.h
trunk/rkward/rkward/scriptbackends/scriptbackend.cpp
trunk/rkward/rkward/scriptbackends/scriptbackend.h
Added Paths:
-----------
trunk/rkward/rkward/scriptbackends/simplebackend.cpp
trunk/rkward/rkward/scriptbackends/simplebackend.h
Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2007-05-10 17:33:39 UTC (rev 1897)
@@ -33,6 +33,7 @@
#include "rkstandardcomponentgui.h"
#include "../scriptbackends/phpbackend.h"
+#include "../scriptbackends/simplebackend.h"
#include "../misc/xmlhelper.h"
#include "../settings/rksettingsmoduleplugins.h"
@@ -79,18 +80,27 @@
// initialize the PHP-backend with the code-template
QDomElement element = xml->getChildElement (doc_element, "code", DL_WARNING);
- QString dummy = QFileInfo (filename).dirPath () + '/' + xml->getStringAttribute (element, "file", "code.php", DL_WARNING);
- backend = new PHPBackend ();
+ if (element.hasAttribute ("file")) {
+ QString dummy = QFileInfo (filename).dirPath () + '/' + xml->getStringAttribute (element, "file", "code.php", DL_WARNING);
+ backend = new PHPBackend (dummy);
+ } else {
+ SimpleBackend *back = new SimpleBackend ();
+ back->setPreprocessTemplate (xml->getStringAttribute (element, "preprocess", QString::null, DL_INFO));
+ back->setPrintoutTemplate (xml->getStringAttribute (element, "printout", QString::null, DL_INFO));
+ back->setCalculateTemplate (xml->getStringAttribute (element, "calculate", QString::null, DL_INFO));
+ back->setPreviewTemplate (xml->getStringAttribute (element, "preview", QString::null, DL_INFO));
+ backend = back;
+ }
connect (backend, SIGNAL (idle ()), this, SLOT (backendIdle ()));
connect (backend, SIGNAL (requestValue (const QString&)), this, SLOT (getValue (const QString&)));
connect (backend, SIGNAL (haveError ()), this, SLOT (hide ()));
connect (backend, SIGNAL (haveError ()), this, SLOT (removeFromParent ()));
connect (backend, SIGNAL (haveError ()), this, SLOT (deleteLater ()));
- if (!backend->initialize (dummy, code, parent_component == 0)) return;
+ if (!backend->initialize (code, parent_component == 0)) return;
// check for existance of help file
element = xml->getChildElement (doc_element, "help", DL_WARNING);
- dummy = QFileInfo (filename).dirPath () + '/' + xml->getStringAttribute (element, "file", "::nosuchfile::", DL_INFO);
+ QString dummy = QFileInfo (filename).dirPath () + '/' + xml->getStringAttribute (element, "file", "::nosuchfile::", DL_INFO);
have_help = QFileInfo (dummy).exists ();
handle_change_timer = new QTimer (this);
Modified: trunk/rkward/rkward/plugins/plots/color_chooser.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/color_chooser.xml 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/plugins/plots/color_chooser.xml 2007-05-10 17:33:39 UTC (rev 1897)
@@ -1,10 +1,18 @@
<!DOCTYPE rkplugin>
<document>
- <code file="color_chooser.php" />
+<!-- <code file="color_chooser.php" /> -->
+<!-- WHAT IS THIS?
+ It's a very dirty hack to make the color chooser fast. This is needed, as the color chooser is often embedded many times into a single plugin. Starting a separate PHP process for each of those would be insane. So we need something different...
+
+ This will eventually be replaced by a different (and clean!) scripting solution. For now: don't imitate this! -->
+ <code printout="$$$argument$$$$$$color.string$$$$$$have_col.numeric$$$!!!!?!%3!=!0!:!!?!!=!!:!%1"%2""/>
<help file="color_chooser.rkh" />
<logic>
<external id="argument" default=", col=" />
<external id="default_color" default="" />
+ <connect client="color.string" governor="default_color"/>
+
+ <convert id="have_col" mode="notequals" sources="color.string" standard=""/>
</logic>
<dialog label="Choose color" >
<dropdown id="color" label="Color">
Modified: trunk/rkward/rkward/scriptbackends/Makefile.am
===================================================================
--- trunk/rkward/rkward/scriptbackends/Makefile.am 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/scriptbackends/Makefile.am 2007-05-10 17:33:39 UTC (rev 1897)
@@ -1,8 +1,8 @@
INCLUDES = $(all_includes)
METASOURCES = AUTO
noinst_LIBRARIES = libscriptbackends.a
-noinst_HEADERS = phpbackend.h scriptbackend.h
-libscriptbackends_a_SOURCES = phpbackend.cpp scriptbackend.cpp
+noinst_HEADERS = phpbackend.h scriptbackend.h simplebackend.h
+libscriptbackends_a_SOURCES = phpbackend.cpp scriptbackend.cpp simplebackend.cpp
phpfilesdir = $(kde_datadir)/rkward/phpfiles
phpfiles_DATA = common.php php.ini
Modified: trunk/rkward/rkward/scriptbackends/phpbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.cpp 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.cpp 2007-05-10 17:33:39 UTC (rev 1897)
@@ -30,14 +30,15 @@
#include "../plugin/rkcomponentproperties.h"
#include "../debug.h"
-PHPBackend::PHPBackend() {
+PHPBackend::PHPBackend (const QString &filename) : ScriptBackend () {
RK_TRACE (PHP);
php_process = 0;
eot_string="#RKEND#\n";
eoq_string="#RKQEND#\n";
busy_writing = false;
- busy = false;
+
+ PHPBackend::filename = filename;
}
@@ -46,7 +47,7 @@
destroy ();
}
-bool PHPBackend::initialize (const QString &filename, RKComponentPropertyCode *code_property, bool add_headings) {
+bool PHPBackend::initialize (RKComponentPropertyCode *code_property, bool add_headings) {
RK_TRACE (PHP);
if (php_process && php_process->isRunning ()) {
@@ -111,52 +112,6 @@
data_stack.clear ();
}
-void PHPBackend::callFunction (const QString &function, int flags, int type) {
- RK_TRACE (PHP);
- RK_DO (qDebug ("callFunction %s", function.latin1 ()), PHP, DL_DEBUG);
-
- PHPCommand *command = new PHPCommand;
- command->command = function;
- command->flags = flags;
- command->type = type;
- command->complete = false;
-
- if (code_property) {
- if (type == Preprocess) {
- code_property->setPreprocess (QString::null);
- } else if (type == Calculate) {
- code_property->setCalculate (QString::null);
- } else if (type == Printout) {
- code_property->setPrintout (QString::null);
- } else if (type == Preview) {
- code_property->setPreview (QString::null);
- }
- invalidateCalls (type);
- }
-
- command_stack.append (command);
- tryNextFunction ();
-}
-
-void PHPBackend::invalidateCalls (int type) {
- RK_TRACE (PHP);
-
- if (current_type == type) {
- current_type = Ignore;
- }
-
- QValueList<PHPCommand *>::iterator it = command_stack.begin ();
- while (it != command_stack.end ()) {
- if ((*it)->type == type) {
- delete (*it);
- it = command_stack.erase (it); // it now points to next item
- } else {
- ++it;
- }
- }
-}
-
-
void PHPBackend::tryNextFunction () {
RK_TRACE (PHP);
@@ -181,7 +136,7 @@
void PHPBackend::writeData (const QString &data) {
RK_TRACE (PHP);
- data_stack.append (data + eot_string);
+ data_stack.append (data + eot_string);
tryWriteData ();
}
@@ -257,39 +212,9 @@
if (request == "requesting code") {
startup_done = true;
- busy = false;
RK_DO (qDebug ("got type: %d, stack %d", current_type, command_stack.count ()), PHP, DL_DEBUG);
- if (current_type != Ignore) {
- if (code_property) {
- if (_output.isNull ()) _output = ""; // must not be null for the code property!
- if (current_type == Preprocess) {
- if (add_headings) code_property->setPreprocess (i18n ("## Prepare\n") + retrieveOutput ());
- else code_property->setPreprocess (retrieveOutput ());
- resetOutput ();
- } else if (current_type == Calculate) {
- if (add_headings) code_property->setCalculate (i18n ("## Compute\n") + retrieveOutput ());
- else code_property->setCalculate (retrieveOutput ());
- resetOutput ();
- } else if (current_type == Printout) {
- if (add_headings) code_property->setPrintout (i18n ("## Print result\n") + retrieveOutput ());
- else code_property->setPrintout (retrieveOutput ());
- resetOutput ();
- } else if (current_type == Preview) {
- // no heading for the preview code (not shown in the code box)
- code_property->setPreview (retrieveOutput ());
- resetOutput ();
- } else {
- emit (commandDone (current_flags));
- }
- } else {
- emit (commandDone (current_flags));
- }
- }
- tryNextFunction ();
- if (!busy) {
- emit (idle ());
- return;
- }
+ commandFinished (_output);
+ _output = QString::null;
} else if (request.startsWith ("requesting data:")) {
QString requested_object = request.remove ("requesting data:");
RK_DO (qDebug ("requested data: \"%s\"", requested_object.latin1 ()), PHP, DL_DEBUG);
Modified: trunk/rkward/rkward/scriptbackends/phpbackend.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.h 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.h 2007-05-10 17:33:39 UTC (rev 1897)
@@ -36,11 +36,11 @@
class PHPBackend : public ScriptBackend {
Q_OBJECT
public:
- PHPBackend ();
+ PHPBackend (const QString &filename);
~PHPBackend ();
- bool initialize (const QString &filename, RKComponentPropertyCode *code_property=0, bool add_headings=true);
+ bool initialize (RKComponentPropertyCode *code_property=0, bool add_headings=true);
void destroy ();
void preprocess (int flags) { callFunction ("preprocess ();", flags, Preprocess); };
@@ -69,27 +69,9 @@
bool doing_command;
bool startup_done;
QString output_raw_buffer;
-
- struct PHPCommand {
- /// the command string
- QString command;
- /// flags attached to this command by the parent
- int flags;
- /// internal type (used to find out, if this is a preproces, calculate, printout, or cleanup call)
- int type;
- /// whether command has finished
- bool complete;
- };
- QValueList<PHPCommand *> command_stack;
- int current_flags;
- int current_type;
-
-/** Invalidate all previous calls of the given type */
- void invalidateCalls (int type);
-
-/** call a PHP-function on the current template. */
- void callFunction (const QString &function, int flags, int type);
+ QString _output;
+ QString filename;
};
#endif
Modified: trunk/rkward/rkward/scriptbackends/scriptbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/scriptbackend.cpp 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/scriptbackends/scriptbackend.cpp 2007-05-10 17:33:39 UTC (rev 1897)
@@ -2,7 +2,7 @@
scriptbackend - description
-------------------
begin : Sun Aug 15 2004
- copyright : (C) 2004 by Thomas Friedrichsmeier
+ copyright : (C) 2004, 2006 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -16,11 +16,97 @@
***************************************************************************/
#include "scriptbackend.h"
+#include <klocale.h>
+
+#include "../plugin/rkcomponentproperties.h"
+
+#include "../debug.h"
+
ScriptBackend::ScriptBackend () : QObject() {
+ busy = false;
}
-
ScriptBackend::~ScriptBackend () {
}
+void ScriptBackend::callFunction (const QString &function, int flags, int type) {
+ RK_TRACE (PHP);
+ RK_DO (qDebug ("callFunction %s", function.latin1 ()), PHP, DL_DEBUG);
+
+ ScriptCommand *command = new ScriptCommand;
+ command->command = function;
+ command->flags = flags;
+ command->type = type;
+ command->complete = false;
+
+ if (code_property) {
+ if (type == Preprocess) {
+ code_property->setPreprocess (QString::null);
+ } else if (type == Calculate) {
+ code_property->setCalculate (QString::null);
+ } else if (type == Printout) {
+ code_property->setPrintout (QString::null);
+ } else if (type == Preview) {
+ code_property->setPreview (QString::null);
+ }
+ invalidateCalls (type);
+ }
+
+ command_stack.append (command);
+ tryNextFunction ();
+}
+
+void ScriptBackend::invalidateCalls (int type) {
+ RK_TRACE (PHP);
+
+ if (current_type == type) {
+ current_type = Ignore;
+ }
+
+ QValueList<ScriptCommand *>::iterator it = command_stack.begin ();
+ while (it != command_stack.end ()) {
+ if ((*it)->type == type) {
+ delete (*it);
+ it = command_stack.erase (it); // it now points to next item
+ } else {
+ ++it;
+ }
+ }
+}
+
+void ScriptBackend::commandFinished (const QString &output) {
+ RK_TRACE (PHP);
+
+ QString _output = output;
+
+ if (current_type != Ignore) {
+ if (code_property) {
+ if (_output.isNull ()) _output = ""; // must not be null for the code property!
+ if (current_type == Preprocess) {
+ if (add_headings) code_property->setPreprocess (i18n ("## Prepare\n") + _output);
+ else code_property->setPreprocess (_output);
+ } else if (current_type == Calculate) {
+ if (add_headings) code_property->setCalculate (i18n ("## Compute\n") + _output);
+ else code_property->setCalculate (_output);
+ } else if (current_type == Printout) {
+ if (add_headings) code_property->setPrintout (i18n ("## Print result\n") + _output);
+ else code_property->setPrintout (_output);
+ } else if (current_type == Preview) {
+ // no heading for the preview code (not shown in the code box)
+ code_property->setPreview (_output);
+ } else {
+ emit (commandDone (current_flags));
+ }
+ } else {
+ emit (commandDone (current_flags));
+ }
+ }
+ busy = false;
+ tryNextFunction ();
+ if (!busy) {
+ emit (idle ());
+ }
+}
+
+
#include "scriptbackend.moc"
Modified: trunk/rkward/rkward/scriptbackends/scriptbackend.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/scriptbackend.h 2007-05-09 22:23:28 UTC (rev 1896)
+++ trunk/rkward/rkward/scriptbackends/scriptbackend.h 2007-05-10 17:33:39 UTC (rev 1897)
@@ -24,7 +24,7 @@
class RKComponentPropertyCode;
/**
-Abstract base class for scripting-language backends. Mostly pure virtual functions only.
+Abstract base class for scripting-language backends. Mostly pure virtual functions only + some handling to make sure the processing is asynchronous.
@author Thomas Friedrichsmeier
*/
@@ -45,11 +45,10 @@
};
/** initialize backend
- at param filename Filename of the template to work on
@param code_property If you supply a pointer to an RKComponentPropertyCode, The backend will directly set values for this property in response to calls to preproces (), calculate (), printout (), and cleanup ().
@param add_headings (Only meaningful, if code_property is not 0). If set to true, heading comments will be added to each section of the code (e.g. "## Do calculations")
@returns true on successful initialization, false on errors */
- virtual bool initialize (const QString &filename, RKComponentPropertyCode *code_property=0, bool add_headings=true) = 0;
+ virtual bool initialize (RKComponentPropertyCode *code_property=0, bool add_headings=true) = 0;
virtual void destroy () = 0;
virtual void preprocess (int flags) = 0;
@@ -60,9 +59,6 @@
virtual bool isBusy () { return busy; };
virtual void writeData (const QString &data) = 0;
-
- QString retrieveOutput () { return _output; };
- void resetOutput () { _output = QString::null; };
signals:
void commandDone (int);
void idle ();
@@ -71,8 +67,30 @@
protected:
RKComponentPropertyCode *code_property;
bool add_headings;
- QString _output;
bool busy;
+
+ struct ScriptCommand {
+ /// the command string
+ QString command;
+ /// flags attached to this command by the parent
+ int flags;
+ /// internal type (used to find out, if this is a preproces, calculate, printout, or cleanup call)
+ int type;
+ /// whether command has finished
+ bool complete;
+ };
+ QValueList<ScriptCommand *> command_stack;
+
+ int current_flags;
+ int current_type;
+
+/** Invalidate all previous calls of the given type */
+ void invalidateCalls (int type);
+/** call a function on the current template. */
+ void callFunction (const QString &function, int flags, int type);
+
+ void commandFinished (const QString &output);
+ virtual void tryNextFunction () = 0;
};
#endif
Added: trunk/rkward/rkward/scriptbackends/simplebackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/simplebackend.cpp (rev 0)
+++ trunk/rkward/rkward/scriptbackends/simplebackend.cpp 2007-05-10 17:33:39 UTC (rev 1897)
@@ -0,0 +1,169 @@
+/***************************************************************************
+ simplebackend - description
+ -------------------
+ begin : Thu May 10 2007
+ copyright : (C) 2007 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "simplebackend.h"
+
+#include "../debug.h"
+
+SimpleBackend::SimpleBackend () : ScriptBackend () {
+ RK_TRACE (PHP);
+}
+
+SimpleBackend::~SimpleBackend () {
+ RK_TRACE (PHP);
+}
+
+bool SimpleBackend::initialize (RKComponentPropertyCode *code_property, bool add_headings) {
+ RK_TRACE (PHP);
+
+ SimpleBackend::code_property = code_property;
+ SimpleBackend::add_headings = add_headings;
+ template_pos = 0;
+
+ return true;
+}
+
+void SimpleBackend::destroy () {
+ RK_TRACE (PHP);
+
+ deleteLater ();
+}
+
+void SimpleBackend::preprocess (int flags) {
+ RK_TRACE (PHP);
+
+ callFunction (QString::null, flags, Preprocess);
+}
+
+void SimpleBackend::calculate (int flags) {
+ RK_TRACE (PHP);
+
+ callFunction (QString::null, flags, Calculate);
+}
+
+void SimpleBackend::printout (int flags) {
+ RK_TRACE (PHP);
+
+ callFunction (QString::null, flags, Printout);
+}
+
+void SimpleBackend::preview (int flags) {
+ RK_TRACE (PHP);
+
+ callFunction (QString::null, flags, Preview);
+}
+
+void SimpleBackend::writeData (const QString &data) {
+ RK_TRACE (PHP);
+
+ current_values.append (data);
+ processCall ();
+}
+
+void SimpleBackend::tryNextFunction () {
+ RK_TRACE (PHP);
+
+ if ((!busy) && (!command_stack.isEmpty ())) {
+ // clean up previous command if applicable
+ if (command_stack.first ()->complete) {
+ delete command_stack.first ();
+ command_stack.pop_front ();
+
+ if (!command_stack.count ()) return;
+ }
+
+ busy = true;
+ command_stack.first ()->complete = true;
+ current_flags = command_stack.first ()->flags;
+ current_type = command_stack.first ()->type;
+
+ current_values.clear ();
+ template_pos = 0;
+ if (current_type == Preprocess) current_template = preprocess_template;
+ else if (current_type == Printout) current_template = printout_template;
+ else if (current_type == Calculate) current_template = calculate_template;
+ else if (current_type == Preview) current_template = preview_template;
+ template_sep = current_template.find ("!!!");
+
+ if (template_sep < 0) {
+ commandFinished ("");
+ return;
+ }
+
+ processCall ();
+ }
+}
+
+void SimpleBackend::processCall () {
+ RK_TRACE (PHP);
+
+ int next_token = current_template.find ("$$$", template_pos);
+ if (next_token < 0) next_token = template_sep;
+ if (next_token > template_sep) next_token = template_sep;
+
+ if (next_token < template_sep) {
+ int token_end = current_template.find ("$$$", next_token + 3);
+ RK_ASSERT (token_end >= 0);
+ QString token = current_template.mid (next_token + 3, token_end - (next_token + 3));
+ template_pos = token_end + 3;
+ emit (requestValue (token));
+ return;
+ }
+
+ // all values are fetched. Now generate the return string
+ finishCall (current_template.mid (template_sep + 3));
+}
+
+void SimpleBackend::finishCall (const QString &conditions) {
+ RK_TRACE (PHP);
+
+ QString conds = conditions;
+ int repl = current_values.count();
+ for (int i = repl; i > 0; --i) {
+ QString placeholder = "%" + QString::number (i);
+ QString replacement = current_values[i-1];
+ conds.replace (placeholder, replacement);
+ }
+
+ QString output;
+ int pos = 3;
+ int max = conds.length ();
+ do {
+ int cond_end = conds.find ("!?!", pos);
+ if (cond_end < 0) cond_end = max;
+ QString condition = conds.mid (pos, cond_end - pos);
+
+ int if_end = condition.find ("!:!");
+ RK_ASSERT (if_end >= 0);
+ QString if_part = condition.left (if_end);
+
+ int if_mid = if_part.find ("!=!");
+ RK_ASSERT (if_mid >= 0);
+ QString if_compare = if_part.left (if_mid);
+
+ QString if_against = if_part.mid (if_mid + 3);
+ if ((if_compare.isEmpty() && if_against.isEmpty ()) || (if_compare == if_against)) {
+ output = condition.mid (if_end + 3);
+ break;
+ }
+
+ pos = cond_end + 3;
+ } while (pos < max);
+
+ // reached end of template
+ commandFinished (output);
+}
Added: trunk/rkward/rkward/scriptbackends/simplebackend.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/simplebackend.h (rev 0)
+++ trunk/rkward/rkward/scriptbackends/simplebackend.h 2007-05-10 17:33:39 UTC (rev 1897)
@@ -0,0 +1,68 @@
+/***************************************************************************
+ simplebackend - description
+ -------------------
+ begin : Thu May 10 2007
+ copyright : (C) 2007 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef SIMPLEBACKEND_H
+#define SIMPLEBACKEND_H
+
+#include "scriptbackend.h"
+
+#include <qstringlist.h>
+
+/** @brief A very simple script backend
+
+This class provides a very simple alternative to the PHP backend. Right now it's basically just used as a hack to reduce the overhead of starting a PHP process for each color_chooser component (which is often embedded many times inside a single plugin).
+
+This class is very hackish and NOT sure to stay! It might be obsoleted by another scripting solution.
+
+ at author Thomas Friedrichsmeier
+*/
+class SimpleBackend : public ScriptBackend {
+public:
+ SimpleBackend ();
+ ~SimpleBackend ();
+
+ void setPreprocessTemplate (const QString &template_string) { preprocess_template = template_string; };
+ void setCalculateTemplate (const QString &template_string) { calculate_template = template_string; };
+ void setPrintoutTemplate (const QString &template_string) { printout_template = template_string; };
+ void setPreviewTemplate (const QString &template_string) { preview_template = template_string; };
+
+ bool initialize (RKComponentPropertyCode *code_property=0, bool add_headings=true);
+ void destroy ();
+
+ void preprocess (int flags);
+ void calculate (int flags);
+ void printout (int flags);
+ void preview (int flags);
+
+ void writeData (const QString &data);
+ void tryNextFunction ();
+private:
+ QString preprocess_template;
+ QString calculate_template;
+ QString printout_template;
+ QString preview_template;
+ QString current_template;
+
+ int template_sep;
+ int template_pos;
+ QStringList current_values;
+
+ void processCall ();
+ void finishCall (const QString &conditions);
+};
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list