diff options
| author | 2015-11-12 13:13:16 +0100 | |
|---|---|---|
| committer | 2015-11-12 13:13:16 +0100 | |
| commit | f8d2d34a4ac0b9514b6eecac66ba6b54520fa550 (patch) | |
| tree | 058d9da81a5d7c0283f03f63ec0453abcf2fbbe9 /dicealias.cpp | |
| parent | 7ce5a4af6fb836432eb6ce7637ea09d6a5b4e0bd (diff) | |
| download | OneRoll-f8d2d34a4ac0b9514b6eecac66ba6b54520fa550.tar.gz OneRoll-f8d2d34a4ac0b9514b6eecac66ba6b54520fa550.zip | |
Add enable management of alias
Diffstat (limited to 'dicealias.cpp')
| -rw-r--r-- | dicealias.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/dicealias.cpp b/dicealias.cpp index f9c366c..e7faa2f 100644 --- a/dicealias.cpp +++ b/dicealias.cpp @@ -22,8 +22,8 @@ #include "dicealias.h" #include <QRegularExpression> -DiceAlias::DiceAlias(QString cmd, QString key, bool isReplace) - : m_command(cmd),m_value(key) +DiceAlias::DiceAlias(QString cmd, QString key, bool isReplace, bool isEnable) + : m_command(cmd),m_value(key),m_isEnable(isEnable) { if(isReplace) { @@ -42,6 +42,8 @@ DiceAlias::~DiceAlias() bool DiceAlias::resolved(QString & str) { + if(!m_isEnable) + return false; if((m_type == REPLACE)&&(str.contains(m_command))) { str.replace(m_command,m_value); @@ -97,3 +99,11 @@ void DiceAlias::setReplace(bool b) m_type = REGEXP; } } +bool DiceAlias::isEnable() const +{ + return m_isEnable; +} +void DiceAlias::setEnable(bool b) +{ + m_isEnable = b; +} |