Reserve one name outside a pattern data base.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-06-19 14:58:13 +03:00
parent 3934a6e9b6
commit b7f731802d
3 changed files with 10 additions and 4 deletions

View File

@ -1749,7 +1749,13 @@ void VPattern::SetAuthor(const QString &text)
}
//---------------------------------------------------------------------------------------------------------------------
QString VPattern::GenerateLabel(const LabelType &type) const
/**
* @brief GenerateLabel create label for pattern piece of point.
* @param type type of the label.
* @param reservedName reversed point name. Use when need reserve name, but point is not in data base yet.
* @return unique name for current pattern piece.
*/
QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedName) const
{
QDomNodeList drawList = elementsByTagName(TagDraw);
@ -1805,7 +1811,7 @@ QString VPattern::GenerateLabel(const LabelType &type) const
{
break;
}
} while (data->IsUnique(name) == false);
} while (data->IsUnique(name) == false || name == reservedName);
qCDebug(vXML, "Point label: %s", name.toUtf8().constData());
return name;
}

View File

@ -65,7 +65,7 @@ public:
QString GetAuthor() const;
void SetAuthor(const QString &text);
virtual QString GenerateLabel(const LabelType &type)const;
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const;
public slots:
void LiteParseTree(const Document &parse);

View File

@ -67,7 +67,7 @@ public:
virtual void IncrementReferens(quint32 id) const=0;
virtual void DecrementReferens(quint32 id) const=0;
virtual QString GenerateLabel(const LabelType &type)const=0;
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const=0;
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;