forked from Mudlet/Mudlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTAlias.h
88 lines (73 loc) · 3.31 KB
/
TAlias.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef _TALIAS_H_
#define _TALIAS_H_
/***************************************************************************
* Copyright (C) 2008-2009 by Heiko Koehn *
* KoehnHeiko@googlemail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
#include <fstream>
#include <list>
#include <string>
#include <QMutex>
#include <QTimer>
#include <QString>
#include <QRegExp>
#include "Tree.h"
#include <QDataStream>
#include "Host.h"
#include <pcre.h>
class TLuaInterpreter;
class TAlias : public Tree<TAlias>
{
friend class XMLexport;
friend class XMLimport;
public:
virtual ~TAlias();
TAlias( TAlias * parent, Host * pHost );
TAlias( QString name, Host * pHost );
TAlias& clone(const TAlias& );
QString getName() { return mName; }
void setName( QString name ) { mName = name; }
void compile();
bool compileScript();
void execute();
QString getScript() { return mScript; }
bool setScript( QString & script );
QString getRegexCode() { return mRegexCode; }
void setRegexCode( QString );
void setCommand( QString command ) { mCommand = command; }
QString getCommand() { return mCommand; }
bool isFolder() { return mIsFolder; }
void setIsFolder( bool b ) { mIsFolder = b; }
bool match( QString & toMatch );
bool registerAlias();
bool isClone(TAlias &b) const;
private:
TAlias(){};
QString mName;
QString mCommand;
QString mRegexCode;
pcre * mpRegex;
QString mScript;
bool mIsFolder;
Host * mpHost;
bool mNeedsToBeCompiled;
QString mFuncName;
TLuaInterpreter * mpLua;
};
#endif