X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/4cf57e6db08da791233d75237f62e74bc88dd427..eb12792fe5344f4d128b8aba2a7948aa13f6a1ae:/AbstractBlock.cpp?ds=sidebyside diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index f551b30..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) { @@ -235,3 +235,11 @@ 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; +} + +