File: Trigger.cpp

package info (click to toggle)
herculesstudio 1.5.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,376 kB
  • sloc: cpp: 17,077; xml: 21; makefile: 13
file content (39 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (3)
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
#include "Trigger.h"

Trigger::Trigger()
{

}

void Trigger::set(int line, int column, TriggerType trigger, QString &text)
{
    mLine = line;
    mColumn = column;
    mTriggerType = trigger;
    mText = text;
}

void Trigger::set(int line, int column, int trigger, QString &text)
{
    set(line, column, static_cast<TriggerType>(trigger), text);
}

const QString& Trigger::decodeTriggerType(TriggerType type)
{
    static const QString string("String");
    static const QString regexp("Regular Expression");
    if (type == TriggerString) return string;
    else return regexp;
}

Trigger::TriggerType Trigger::encodeTriggerType(const QString& type)
{
    static const QString string("String");
    static const QString regexp("Regular Expression");
    if (type.compare(string) == 0) return TriggerString;
    else if (type.compare(regexp) == 1) return TriggerRegExp;
    Q_ASSERT_X(false, "encodeTriggerType", "bad trigger name"); //force error
    return TriggerString;
}