summaryrefslogtreecommitdiffstats
path: root/src/extension/script/InkscapeScript.h
blob: 98508e4e645ce56c8120536c90add9dd2602ae1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef __INKSCAPE_SCRIPT_H__
#define __INKSCAPE_SCRIPT_H__

/**
 * Inkscape Scripting container
 *
 * Authors:
 *   Bob Jamison <rjamison@titan.com>
 *
 * Copyright (C) 2004-2008 Bob Jamison
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include "config.h"

#include <glibmm.h>

namespace Inkscape
{
namespace Extension
{
namespace Script
{



/**
 * This class is used to run scripts, either from a file or buffer
 */
class InkscapeScript
{
public:

    /**
     * Which type of language?
     */
    typedef enum
        {
        JAVASCRIPT,
        PYTHON,
        RUBY
        } ScriptLanguage;

    /**
     * Creates a generic script interpreter.
     */
    InkscapeScript();

    /**
     *  Destructor
     */
    virtual ~InkscapeScript();

    /**
     * Interprets the script in the 'script' buffer,
     * storing the stdout output in 'output', and any
     * error messages in 'error.'  Language is one of the
     * enumerated types in ScriptLanguage above.
     */
    bool interpretScript(const Glib::ustring &script,
                         Glib::ustring &output,
                         Glib::ustring &error,
                         ScriptLanguage language);

    /**
     * Interprets the script in the named file,
     * storing the stdout output in 'output', and any
     * error messages in 'error.'  Language is one of the
     * enumerated types in ScriptLanguage above.
     */
    bool interpretFile(const Glib::ustring &fname,
                      Glib::ustring &output,
                      Glib::ustring &error,
                      ScriptLanguage language);



}; //class InkscapeScript




}  // namespace Script
}  // namespace Extension
}  // namespace Inkscape



#endif  /* __INKSCAPE_SCRIPT_H__ */

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :