| 1 | /* |
| 2 | * File: Trigger.h |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: May 10, 2014 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * This object represents a trigger for the Hercules Studio printer. A trigger changes the behavior of the printer |
| 11 | * (E.g., creation of a job file). |
| 12 | * |
| 13 | * This program is free software: you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation, either version 3 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License |
| 24 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 25 | * |
| 26 | */ |
| 27 | #ifndef TRIGGER_H |
| 28 | #define TRIGGER_H |
| 29 | |
| 30 | #include <QString> |
| 31 | |
| 32 | class Trigger |
| 33 | { |
| 34 | public: |
| 35 | Trigger(); |
| 36 | Trigger(const QString& triggerString); |
| 37 | enum TriggerType |
| 38 | { |
| 39 | TriggerString, |
| 40 | TriggerRegExp |
| 41 | }; |
| 42 | void set(int line, int column, TriggerType trigger, QString& text); |
| 43 | void set(int line, int column, int trigger, QString& text); |
| 44 | static const QString &decodeTriggerType(TriggerType type); |
| 45 | static TriggerType encodeTriggerType(const QString &type); |
| 46 | |
| 47 | inline int line() { return mLine; } |
| 48 | inline int column() { return mColumn; } |
| 49 | inline TriggerType triggerType() { return mTriggerType; } |
| 50 | inline QString text() { return mText; } |
| 51 | |
| 52 | inline void setLine(int line) { mLine = line; } |
| 53 | inline void setColumn(int column) { mColumn = column; } |
| 54 | inline void setTriggerType(TriggerType triggerType) { mTriggerType = triggerType; } |
| 55 | inline void setText(QString text) { mText = text; } |
| 56 | |
| 57 | private: |
| 58 | int mLine; // line to look for |
| 59 | int mColumn; // column to look for |
| 60 | TriggerType mTriggerType; // trigger type |
| 61 | QString mText; // validation text |
| 62 | }; |
| 63 | |
| 64 | #endif // TRIGGER_H |