1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
/*
* This file is part of the xTuple ERP: PostBooks Edition, a free and
* open source Enterprise Resource Planning software suite,
* Copyright (c) 1999-2010 by OpenMFG LLC, d/b/a xTuple.
* It is licensed to you under the Common Public Attribution License
* version 1.0, the full text of which (including xTuple-specific Exhibits)
* is available at www.xtuple.com/CPAL. By using this software, you agree
* to be bound by its terms.
*/
#ifndef __SCRIPT_H__
#define __SCRIPT_H__
#include <QString>
#include <QStringList>
class QDomDocument;
class QDomElement;
#define TR(a) QObject::tr(a)
class Script
{
public:
enum OnError {
Default = 0,
Stop,
Prompt,
Ignore
};
Script(const QString & name = QString::null, OnError onError = Default,
const QString & comment = QString::null);
Script(const QDomElement &, QStringList &msg, QList<bool> &fatal);
virtual ~Script();
virtual QDomElement createElement(QDomDocument &);
virtual bool isValid() const { return !_name.isEmpty(); }
virtual QString filename() const;
virtual QString name() const { return _name; }
virtual void setName(const QString & name) { _name = name; }
virtual OnError onError() const { return _onError; }
virtual void setOnError(OnError onError) { _onError = onError; }
virtual QString comment() const { return _comment; }
virtual void setComment(const QString & comment) { _comment = comment; }
virtual int writeToDB(const QByteArray &data, const QString annotation, QString &errMsg);
static QString onErrorToName(OnError);
static OnError nameToOnError(const QString &);
static QStringList onErrorList(bool includeDefault = TRUE);
protected:
QString _name;
QString _comment;
OnError _onError;
static QString _sqlerrtxt;
};
#endif
|