X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/5d4e709cb8d460b2efc083e6e7999f1c3a0eb602..eb12792fe5344f4d128b8aba2a7948aa13f6a1ae:/AbstractBlock.cpp diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index 66c8f37..cdde69f 100644 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@ -10,7 +10,7 @@ AbstractBlock::AbstractBlock() { } AbstractBlock::AbstractBlock(const QString& _name) { - name = _name; + name = normalizeName(_name); parent = NULL; } @@ -25,7 +25,7 @@ AbstractBlock::~AbstractBlock() { } void AbstractBlock::setName(const QString& str) { - name = str; + name = normalizeName(str); } void AbstractBlock::setParent(AbstractBlock* _parent) { @@ -234,3 +234,12 @@ QList AbstractBlock::getWishboneParameters() { } return lst; } + +QString AbstractBlock::normalizeName(const QString &name) { + QString s = name; + s.replace(QRegularExpression("[^a-zA-Z0-9_]"),"_"); + s.replace(QRegularExpression("[_]+"),"_"); + return s; +} + +