Fixed issue #967. Variable must not include new line character.

(grafted from f263dbaec52fb6950e1db27c62313f57748f4838)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-04-20 20:19:30 +03:00
parent 000062b7b7
commit 65a9be6b9d
8 changed files with 10 additions and 9 deletions

View File

@ -39,6 +39,7 @@
- [#963] Bug in tool Point intersect curve and axis. - [#963] Bug in tool Point intersect curve and axis.
- [#964] Assign operator crashes math parser. - [#964] Assign operator crashes math parser.
- [#966] Unable to control Approximation scale for arc with length. - [#966] Unable to control Approximation scale for arc with length.
- [#967] Variable must not include new line character.
# Version 0.6.1 October 23, 2018 # Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements. - [#885] Regression. Broken support for multi size measurements.

View File

@ -3882,7 +3882,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node, const Document &pars
{ {
if (domElement.tagName() == TagIncrement) if (domElement.tagName() == TagIncrement)
{ {
const QString name = GetParametrString(domElement, AttrName, QString()); const QString name = GetParametrString(domElement, AttrName, QString()).simplified();
const QString desc = GetParametrEmptyString(domElement, AttrDescription); const QString desc = GetParametrEmptyString(domElement, AttrDescription);
const IncrementType type = StringToIncrementType(GetParametrString(domElement, AttrType, const IncrementType type = StringToIncrementType(GetParametrString(domElement, AttrType,
strTypeIncrement)); strTypeIncrement));

View File

@ -42,7 +42,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;'\\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;\\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="formatVersion"> <xs:simpleType name="formatVersion">

View File

@ -763,7 +763,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -43,7 +43,7 @@
</xs:element> </xs:element>
<xs:simpleType name="shortName"> <xs:simpleType name="shortName">
<xs:restriction base="xs:string"> <xs:restriction base="xs:string">
<xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;'\\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^\-()+=?:;\\&quot;]){0,}"/> <xs:pattern value="([^\p{Nd}\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;'\&quot;]){1,1}([^\p{Zs}*/&amp;|!&lt;&gt;^&#10;\()\-+.,٫, ٬.=?:;\&quot;]){0,}"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
<xs:simpleType name="units"> <xs:simpleType name="units">

View File

@ -317,14 +317,14 @@ QString NameRegExp()
} }
} }
negativeSigns.replace('-', "\\-"); negativeSigns.replace('-', QLatin1String("\\-"));
groupSeparators.remove('\''); groupSeparators.remove('\'');
//Same regexp in pattern.xsd shema file. Don't forget to synchronize. //Same regexp in pattern.xsd shema file. Don't forget to synchronize.
// \p{Nd} - \p{Decimal_Digit_Number} // \p{Nd} - \p{Decimal_Digit_Number}
// \p{Zs} - \p{Space_Separator} // \p{Zs} - \p{Space_Separator}
regex = QString("^([^\\p{Nd}\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;'\"]){1,1}" regex = QString("^([^\\p{Nd}\\p{Zs}*/&|!<>^\n\\()%1%2%3%4=?:;'\"]){1,1}"
"([^\\p{Zs}*/&|!<>^\\()%1%2%3%4=?:;\"]){0,}$") "([^\\p{Zs}*/&|!<>^\n\\()%1%2%3%4=?:;\"]){0,}$")
.arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators); .arg(negativeSigns, positiveSigns, decimalPoints, groupSeparators);
} }

View File

@ -264,7 +264,7 @@ void VMeasurements::ReadMeasurements(qreal height, qreal size) const
{ {
const QDomElement dom = list.at(i).toElement(); const QDomElement dom = list.at(i).toElement();
const QString name = GetParametrString(dom, AttrName); const QString name = GetParametrString(dom, AttrName).simplified();
const QString description = GetParametrEmptyString(dom, AttrDescription); const QString description = GetParametrEmptyString(dom, AttrDescription);
const QString fullName = GetParametrEmptyString(dom, AttrFullName); const QString fullName = GetParametrEmptyString(dom, AttrFullName);

View File

@ -94,7 +94,7 @@ QString VInternalVariable::GetName() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VInternalVariable::SetName(const QString &name) void VInternalVariable::SetName(const QString &name)
{ {
d->name = name; d->name = name.simplified();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------