~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/scriptbackends/simplebackend.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2008-04-20 21:30:00 UTC
  • mfrom: (1.2.2 upstream) (3.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080420213000-fs4i8efmfc793bnn
new upstream release
closes: #475175
closes: #463348
closes: #475982

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          simplebackend  -  description
 
3
                             -------------------
 
4
    begin                : Thu May 10 2007
 
5
    copyright            : (C) 2007 by Thomas Friedrichsmeier
 
6
    email                : tfry@users.sourceforge.net
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#ifndef SIMPLEBACKEND_H
 
19
#define SIMPLEBACKEND_H
 
20
 
 
21
#include "scriptbackend.h"
 
22
 
 
23
#include <qstringlist.h>
 
24
 
 
25
/** @brief A very simple script backend
 
26
 
 
27
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).
 
28
 
 
29
This class is very hackish and NOT sure to stay! It might be obsoleted by another scripting solution.
 
30
 
 
31
@author Thomas Friedrichsmeier
 
32
*/
 
33
class SimpleBackend : public ScriptBackend {
 
34
public:
 
35
        SimpleBackend ();
 
36
        ~SimpleBackend ();
 
37
 
 
38
        void setPreprocessTemplate (const QString &template_string) { preprocess_template = template_string; };
 
39
        void setCalculateTemplate (const QString &template_string) { calculate_template = template_string; };
 
40
        void setPrintoutTemplate (const QString &template_string) { printout_template = template_string; };
 
41
        void setPreviewTemplate (const QString &template_string) { preview_template = template_string; };
 
42
 
 
43
        bool initialize (RKComponentPropertyCode *code_property=0, bool add_headings=true);
 
44
        void destroy ();
 
45
        
 
46
        void preprocess (int flags);
 
47
        void calculate (int flags);
 
48
        void printout (int flags);
 
49
        void preview (int flags);
 
50
        
 
51
        void writeData (const QString &data);
 
52
        void tryNextFunction ();
 
53
private:
 
54
        QString preprocess_template;
 
55
        QString calculate_template;
 
56
        QString printout_template;
 
57
        QString preview_template;
 
58
        QString current_template;
 
59
 
 
60
        int template_sep;
 
61
        int template_pos;
 
62
        QStringList current_values;
 
63
 
 
64
        void processCall ();
 
65
        void finishCall (const QString &conditions);
 
66
};
 
67
 
 
68
#endif