koscript.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KSCRIPT_H__
00021 #define __KSCRIPT_H__
00022
00023 #include <qstring.h>
00024 #include <qmap.h>
00025 #include <qshared.h>
00026 #include <qstringlist.h>
00027
00028 #include <kregexp.h>
00029
00030 #include <../kofficecore/koffice_export.h>
00031
00032 #include "koscript_context.h"
00033 #include "koscript_parsenode.h"
00034 #include "koscript_ptr.h"
00035 #include "koscript_value.h"
00036
00037 class QTextStream;
00038 class QIODevice;
00039
00047 class KOSCRIPT_EXPORT KSInterpreter : public QShared
00048 {
00049 public:
00050 typedef KSSharedPtr<KSInterpreter> Ptr;
00051
00056 KSInterpreter();
00060 virtual ~KSInterpreter();
00061
00071 QString runScript( const QString& filename, const QStringList& args );
00072
00086 bool runModule( KSContext& context, const QString& name, const QString& filename, const QStringList& args );
00087
00093 bool runModule( KSContext& context, const QString& name );
00098 KSModule::Ptr module( const QString& name );
00099
00105 KSContext& context() { return m_globalContext; }
00106
00112 void addSearchPath( const QString& p ) { m_searchPaths.prepend( p ); }
00113
00121 virtual bool processExtension( KSContext& context, KSParseNode* node );
00122
00126 KRegExp* regexp();
00127
00131 QString readInput();
00132
00136 KSValue::Ptr lastInputLine() const;
00137
00142 KSNamespace* globalNamespace() { return m_global; }
00143
00144 protected:
00148 KSNamespace* m_global;
00153 KSContext m_globalContext;
00159 QMap<QString,KSModule::Ptr> m_modules;
00163 QStringList m_searchPaths;
00167 KRegExp m_regexp;
00172 QStringList m_args;
00180 int m_currentArg;
00186 QTextStream* m_outStream;
00190 QIODevice* m_outDevice;
00196 KSValue::Ptr m_lastInputLine;
00197 };
00198
00199 #endif
This file is part of the documentation for lib Library Version 1.4.2.