• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KJS-API

kjsinterpreter.h

Go to the documentation of this file.
00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (C) 2008 Harri Porten (porten@kde.org)
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  *
00020  */
00021 
00022 #ifndef KJSINTERPRETER_H
00023 #define KJSINTERPRETER_H
00024 
00025 #include "kjsapi_export.h"
00026 #include "kjsobject.h"
00027 #include "kjscontext.h"
00028 
00029 class KJSPrototype;
00030 class KJSInterpreter;
00031 class KJSInterpreterHandle;
00032 class KJSResultHandle;
00033 
00037 class KJSAPI_EXPORT KJSResult
00038 {
00039     friend class KJSInterpreter;
00040 public:
00044     KJSResult();
00048     KJSResult(const KJSResult&);
00052     KJSResult& operator=(const KJSResult&);
00056     ~KJSResult();
00060     bool isException() const;
00061 
00065     QString errorMessage() const;
00066     /*
00067      * If the evaluation was successfull, i.e. isException() is false
00068      * this function returns the value returned by the script. Can be
00069      * an "undefined" (isUndefined()) value.
00070      */
00071     KJSObject value() const;
00072 
00073 private:
00074     KJSResultHandle* hnd;
00075 };
00076 
00082 class KJSAPI_EXPORT KJSInterpreter
00083 {
00084     friend class KJSResult;
00085     friend class KJSPrototype;
00086     friend class KJSContext;
00087 public:
00091     KJSInterpreter();
00095     KJSInterpreter(const KJSGlobalObject& global);
00099     KJSInterpreter(const KJSInterpreter& other);
00103     KJSInterpreter& operator=(const KJSInterpreter& other);
00109     ~KJSInterpreter();
00110 
00114     KJSContext* globalContext();
00118     const KJSContext* globalContext() const;
00123     KJSObject globalObject();
00130     KJSResult evaluate(const QString& sourceURL, int startingLineNumber,
00131                        const QString& code,
00132                        KJSObject* thisValue = 0);
00136     KJSResult evaluate(const QString& code,
00137                        KJSObject* thisValue = 0);
00138 
00154     static bool normalizeCode(const QString& codeIn, QString* codeOut,
00155                               int* errLine = 0, QString* errMsg = 0);
00156 private:
00157     KJSInterpreter(KJSInterpreterHandle* h);
00158     KJSInterpreterHandle* hnd;
00159     KJSContext globCtx;
00160 };
00161 
00162 #endif

KJS-API

Skip menu "KJS-API"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal