File indexing completed on 2024-12-08 09:41:27
0001 /* 0002 SPDX-FileCopyrightText: 2003 Malte Starostik <malte@kde.org> 0003 SPDX-FileCopyrightText: 2011 Dawit Alemayehu <adawit@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KPAC_SCRIPT_H 0009 #define KPAC_SCRIPT_H 0010 0011 #include <QString> 0012 0013 class QUrl; 0014 class QJSEngine; 0015 0016 namespace KPAC 0017 { 0018 class Script 0019 { 0020 public: 0021 class Error 0022 { 0023 public: 0024 explicit Error(const QString &message) 0025 : m_message(message) 0026 { 0027 } 0028 const QString &message() const 0029 { 0030 return m_message; 0031 } 0032 0033 private: 0034 QString m_message; 0035 }; 0036 0037 explicit Script(const QString &code); 0038 ~Script(); 0039 Script(const Script &) = delete; 0040 Script &operator=(const Script &) = delete; 0041 QString evaluate(const QUrl &); 0042 0043 private: 0044 QJSEngine *m_engine; 0045 }; 0046 } 0047 0048 #endif // KPAC_SCRIPT_H