lib

script.h
1/***************************************************************************
2 * script.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_API_SCRIPT_H
21#define KROSS_API_SCRIPT_H
22
23#include <tqstring.h>
24#include <tqstringlist.h>
25
26#include "class.h"
27
28namespace Kross { namespace Api {
29
30 // Forward declarations.
31 class Object;
32 class Interpreter;
33 class ScriptContainer;
34 class List;
35 class Exception;
36
45 class Script
46 {
47 public:
48
57 Script(Interpreter* const interpreter, ScriptContainer* const scriptcontainer);
58
62 virtual ~Script();
63
68 bool hadException();
69
74
81
86 void clearException();
87
95
100 virtual const TQStringList& getFunctionNames() = 0;
101
110 virtual Kross::Api::Object::Ptr callFunction(const TQString& name, Kross::Api::List::Ptr args) = 0;
111
115 virtual const TQStringList& getClassNames() = 0;
116
124 virtual Kross::Api::Object::Ptr classInstance(const TQString& name) = 0;
125
126 protected:
131
132 private:
134 Exception::Ptr m_exception;
135 };
136
137}}
138
139#endif
140
Common exception class used for representing exceptions in Kross.
Definition exception.h:39
TDESharedPtr< Exception > Ptr
Shared pointer to implement reference-counting.
Definition exception.h:45
Base class for interpreters.
The List class implementates Value to handle lists and collections.
Definition list.h:37
TDESharedPtr< List > Ptr
Shared pointer to implement reference-counting.
Definition list.h:44
The common Object class all other object-classes are inheritated from.
Definition object.h:51
TDESharedPtr< Object > Ptr
Shared pointer to implement reference-counting.
Definition object.h:57
The ScriptContainer class is something like a single standalone scriptfile.
bool hadException()
Definition script.cpp:40
Interpreter *const m_interpreter
The Interpreter used to create this Script instance.
Definition script.h:128
Script(Interpreter *const interpreter, ScriptContainer *const scriptcontainer)
Constructor.
Definition script.cpp:29
virtual Kross::Api::Object::Ptr execute()=0
Execute the script.
void setException(Exception::Ptr e)
Set a new exception this script throwed.
Definition script.cpp:50
virtual Kross::Api::Object::Ptr callFunction(const TQString &name, Kross::Api::List::Ptr args)=0
Call a function.
virtual ~Script()
Destructor.
Definition script.cpp:36
virtual const TQStringList & getFunctionNames()=0
void clearException()
Clear previous exceptions.
Definition script.cpp:55
Exception::Ptr getException()
Definition script.cpp:45
virtual const TQStringList & getClassNames()=0
ScriptContainer *const m_scriptcontainer
The ScriptContainer associated with this Script.
Definition script.h:130
virtual Kross::Api::Object::Ptr classInstance(const TQString &name)=0
Create and return a new class instance.
The common Kross API used as common codebase.
Definition callable.h:31
The Kross scripting bridge to embed scripting functionality into an application.
Definition callable.h:31