lib

pythonsecurity.h
1/***************************************************************************
2 * pythonsecurity.h
3 * This file is part of the KDE project
4 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#ifndef KROSS_PYTHON_SECURITY_H
21#define KROSS_PYTHON_SECURITY_H
22
23#include "pythonconfig.h"
24
25#include <tqstring.h>
26
27namespace Kross { namespace Python {
28
29 // Forward declaration.
31
56 class PythonSecurity : public Py::ExtensionModule<PythonSecurity>
57 {
58 public:
59
66 explicit PythonSecurity(PythonInterpreter* interpreter);
67
71 virtual ~PythonSecurity();
72
85 PyObject* compile_restricted(const TQString& source, const TQString& filename, const TQString& mode);
86
87#if 0
88 //TODO
89 void compile_restricted_function(const Py::Tuple& args, const TQString& body, const TQString& name, const TQString& filename, const Py::Object& globalize = Py::None());
90 void compile_restricted_exec(const TQString& source, const TQString& filename = "<string>");
91 void compile_restricted_eval(const TQString& source, const TQString& filename = "<string>");
92#endif
93
94 private:
96 PythonInterpreter* m_interpreter;
98 Py::Module* m_pymodule;
99
101 inline void initRestrictedPython();
102
104 Py::Object _getattr_(const Py::Tuple&);
105 };
106
107}}
108
109#endif
Python interpreter bridge.
PyObject * compile_restricted(const TQString &source, const TQString &filename, const TQString &mode)
Compile python scripting code and return a restricted code object.
virtual ~PythonSecurity()
Destructor.
PythonSecurity(PythonInterpreter *interpreter)
Constructor.
The Python plugin for the Kross scripting framework.
The Kross scripting bridge to embed scripting functionality into an application.
Definition callable.h:33