From: spo Date: Fri, 24 Jun 2016 12:23:47 +0000 (+0300) Subject: Replace error construction with + with using %1 placeholders X-Git-Tag: V_2.4.0~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba727bd58bc3166536229f47c363a14d5a126fa7;p=modules%2Fshaper.git Replace error construction with + with using %1 placeholders --- diff --git a/src/BuildPlugin/BuildPlugin_Validators.cpp b/src/BuildPlugin/BuildPlugin_Validators.cpp index 9c2be0bae..b75c77e54 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.cpp +++ b/src/BuildPlugin/BuildPlugin_Validators.cpp @@ -119,7 +119,8 @@ bool BuildPlugin_ValidatorBaseForWire::isValid(const std::shared_ptrselectionList(theArguments.front()); if(!aSelectionList.get()) { - theError = "Empty attribute \"" + theArguments.front() + "\"."; + theError = "Empty attribute \"%1\"."; + theError.arg(theArguments.front()); return false; } @@ -165,7 +166,8 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrselectionList(theArguments.front()); if(!aSelectionList.get()) { - theError = "Empty attribute \"" + theArguments.front() + "\"."; + theError = "Empty attribute \"%1\"."; + theError.arg(theArguments.front()); return false; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp index 9722f8836..4057abd68 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp @@ -17,7 +17,8 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute bool aValid = true; std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType != ModelAPI_AttributeSelectionList::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -47,10 +48,8 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute if (!aValid) { std::string aResultGroupName = isPartSetDocument ? ModelAPI_ResultPart::group() : ModelAPI_ResultBody::group(); - theError = "Objects from the " + aResultGroupName + - " group can be selected in the " + aDocument->kind() + - "document, but an objects from the " + anErrorGroupName + - " group is selected."; + theError = "Objects from the %1 group can be selected in the %2 document, but an objects from the %3 group is selected."; + theError.arg(aResultGroupName).arg(aDocument->kind()).arg(anErrorGroupName); } return aValid; } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index ff7d8cb39..c77f516b6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -73,13 +73,15 @@ bool FeaturesPlugin_ValidatorPipeLocations::isValid(const std::shared_ptrgetKind() != "Pipe") { - theError = "Error: Feature \"" + theFeature->getKind() + "\" does not supported by this validator."; + theError = "Error: Feature \"%1\" does not supported by this validator."; + theError.arg(theFeature->getKind()); return false; } AttributeStringPtr aCreationMethodAttr = theFeature->string(aCreationMethodID); if(!aCreationMethodAttr.get()) { - theError = "Error: Could not get \"" + aCreationMethodID + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(aCreationMethodID); return false; } @@ -89,13 +91,15 @@ bool FeaturesPlugin_ValidatorPipeLocations::isValid(const std::shared_ptrselectionList(aBaseObjectsID); if(!aBaseObjectsSelectionList.get()) { - theError = "Error: Could not get \"" + aBaseObjectsID + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(aBaseObjectsID); return false; } AttributeSelectionListPtr aLocationsSelectionList = theFeature->selectionList(aLocationsID); if(!aLocationsSelectionList.get()) { - theError = "Error: Could not get \"" + aBaseObjectsID + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(aBaseObjectsID); return false; } @@ -276,8 +280,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute // Check that object is a shape with allowed type. GeomValidators_ShapeType aShapeTypeValidator; if(!aShapeTypeValidator.isValid(anAttr, theArguments, theError)) { - theError = "Error: Selected shape has unacceptable type. Acceptable types are: faces or wires on sketch, " - "whole sketch(if it has at least one face), and whole objects with shape types: %1"; + theError = "Error: Selected shape has unacceptable type. Acceptable types are: faces or wires on sketch, whole sketch(if it has at least one face), and whole objects with shape types: %1"; std::string anArgumentString; for(auto anIt = theArguments.cbegin(); anIt != theArguments.cend(); ++anIt) { if (!anArgumentString.empty()) @@ -289,7 +292,8 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute } } else { - theError = "Error: Attribute \"" + anAttributeType + "\" does not supported by this validator."; + theError = "Error: Attribute \"%1\" does not supported by this validator."; + theError.arg(anAttributeType); return false; } @@ -302,11 +306,13 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) { - theError = "Error: The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "Error: The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } if (theArguments.size() != 2) { - theError = "Error: Wrong parameters in XML definition for " + theAttribute->attributeType() + " type"; + theError = "Error: Wrong parameters in XML definition for %1 type"; + theError.arg(theAttribute->attributeType()); return false; } // first argument is for the base attribute, second - for skipping feature kind @@ -315,7 +321,8 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); AttributePtr aBaseAttribute = aFeature->attribute(aBaseAttributeId); if (!aBaseAttribute.get()) { - theError = "Wrong parameters in XML definition for " + theAttribute->attributeType() + " type"; + theError = "Wrong parameters in XML definition for %1 type"; + theError.arg(theAttribute->attributeType()); return false; } if (aBaseAttribute->isInitialized()) // when base list of composite feature is already filled, @@ -371,8 +378,8 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid(const std::shared_ptrselection(aBaseShapeID); if(!aShapeAttrSelection.get()) { - theError = "Error: Could not get \"" + aBaseShapeID + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(aBaseShapeID); return false; } @@ -649,19 +657,22 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid(const std::shared_pt static const std::string aSubShapesID = "subshapes"; if(theFeature->getKind() != "Remove_SubShapes") { - theError = "Error: Feature \"" + theFeature->getKind() + "\" does not supported by this validator."; + theError = "Error: Feature \"%1\" does not supported by this validator."; + theError.arg(theFeature->getKind()); return false; } AttributeSelectionPtr aShapeAttrSelection = theFeature->selection(aBaseShapeID); if(!aShapeAttrSelection.get()) { - theError = "Error: Could not get \"" + aBaseShapeID + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(aBaseShapeID); return false; } AttributeSelectionListPtr aSubShapesAttrList = theFeature->selectionList(aSubShapesID); if(!aSubShapesAttrList.get()) { - theError = "Error: Could not get \"" + aSubShapesID + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(aSubShapesID); return false; } @@ -703,7 +714,8 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr { AttributeSelectionListPtr aBaseObjectsAttrList = std::dynamic_pointer_cast(theAttribute); if(!aBaseObjectsAttrList.get()) { - theError = "Error: This validator can only work with selection list in \"" + FeaturesPlugin_Union::ID() + "\" feature."; + theError = "Error: This validator can only work with selection list in \"%1\" feature."; + theError.arg(FeaturesPlugin_Union::ID()); return false; } @@ -730,14 +742,16 @@ bool FeaturesPlugin_ValidatorUnionArguments::isValid(const std::shared_ptrgetKind() != FeaturesPlugin_Union::ID()) { - theError = "Error: This validator supports only \"" + FeaturesPlugin_Union::ID() + "\" feature."; + theError = "Error: This validator supports only \"%1\" feature."; + theError.arg(FeaturesPlugin_Union::ID()); return false; } // Get base objects attribute list. AttributeSelectionListPtr aBaseObejctsAttrList = theFeature->selectionList(FeaturesPlugin_Union::BASE_OBJECTS_ID()); if(!aBaseObejctsAttrList.get()) { - theError = "Error: Could not get \"" + FeaturesPlugin_Union::BASE_OBJECTS_ID() + "\" attribute."; + theError = "Error: Could not get \"%1\" attribute."; + theError.arg(FeaturesPlugin_Union::BASE_OBJECTS_ID()); return false; } diff --git a/src/GeomValidators/GeomValidators_BodyShapes.cpp b/src/GeomValidators/GeomValidators_BodyShapes.cpp index a681fbe5d..504daa4af 100644 --- a/src/GeomValidators/GeomValidators_BodyShapes.cpp +++ b/src/GeomValidators/GeomValidators_BodyShapes.cpp @@ -43,7 +43,8 @@ bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute, } } } else { - theError = "Error: Attribute \"" + anAttributeType + "\" does not supported by this validator."; + theError = "Error: Attribute \"%1\" does not supported by this validator."; + theError.arg(anAttributeType); return false; } diff --git a/src/GeomValidators/GeomValidators_ConstructionComposite.cpp b/src/GeomValidators/GeomValidators_ConstructionComposite.cpp index c748c2cdc..8ae2b2dbf 100644 --- a/src/GeomValidators/GeomValidators_ConstructionComposite.cpp +++ b/src/GeomValidators/GeomValidators_ConstructionComposite.cpp @@ -15,7 +15,8 @@ bool GeomValidators_ConstructionComposite::isValid(const AttributePtr& theAttrib bool aValid = true; if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { aValid = false; - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return aValid; } diff --git a/src/GeomValidators/GeomValidators_Face.cpp b/src/GeomValidators/GeomValidators_Face.cpp index 391ae4f82..dd4155263 100644 --- a/src/GeomValidators/GeomValidators_Face.cpp +++ b/src/GeomValidators/GeomValidators_Face.cpp @@ -38,7 +38,8 @@ bool GeomValidators_Face::isValid(const AttributePtr& theAttribute, { std::string anAttributeType = theAttribute->attributeType(); if (anAttributeType != ModelAPI_AttributeSelection::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } diff --git a/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp b/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp index aa4088daa..29167f8d0 100644 --- a/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp +++ b/src/GeomValidators/GeomValidators_MinObjectsSelected.cpp @@ -24,7 +24,8 @@ bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptrselectionList(aSelectionListId); if(!anAttrSelList.get()) { - theError = "Error: Could not get attribute \"" + aSelectionListId + "\"."; + theError = "Error: Could not get attribute \"%1\"."; + theError.arg(aSelectionListId); return false; } int anObjectsNb = anAttrSelList->size(); @@ -32,8 +33,8 @@ bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptrattributeType(); aValid = anAttributeType == GeomDataAPI_Point2D::typeId(); - if (!aValid) - theError = "Shape type is \"" + anAttributeType + - "\", it should be \"" + getShapeTypeDescription(theShapeType) + "\""; + if (!aValid) { + theError = "Shape type is \"%1\", it should be \"%2\""; + theError.arg(anAttributeType).arg(getShapeTypeDescription(theShapeType)); + } } } } @@ -153,7 +154,8 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute } else { aValid = false; - theError = "The attribute with the " + anAttributeType + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(anAttributeType); } return aValid; } diff --git a/src/Model/Model_FeatureValidator.cpp b/src/Model/Model_FeatureValidator.cpp index 06923d324..479405e4a 100644 --- a/src/Model/Model_FeatureValidator.cpp +++ b/src/Model/Model_FeatureValidator.cpp @@ -44,7 +44,8 @@ bool Model_FeatureValidator::isValid(const std::shared_ptr& th myNotObligatory.find(theFeature->getKind()); if (aFeatureFind == myNotObligatory.end() || // and it is obligatory for filling aFeatureFind->second.find(*it) == aFeatureFind->second.end()) { - theError = "Attribute \"" + anAttr->id() + "\" is not initialized."; + theError = "Attribute \"%1\" is not initialized."; + theError.arg(anAttr->id()); return false; } } diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.cpp b/src/ParametersPlugin/ParametersPlugin_Validators.cpp index ec550aeca..d0549db52 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Validators.cpp @@ -30,12 +30,14 @@ bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribut { AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(theAttribute); if (!aStrAttr->isInitialized()) { - theError = "Attribute \"" + aStrAttr->id() + "\" is not initialized."; + theError = "Attribute \"%1\" is not initialized."; + theError.arg(aStrAttr->id()); return false; } bool isEmptyExpr = aStrAttr->value().empty(); if (isEmptyExpr) { - theError = "Attribute \"" + aStrAttr->id() + "\" value is empty."; + theError = "Attribute \"%1\" value is empty."; + theError.arg(aStrAttr->id()); return false; } if (!isVariable(aStrAttr->value())) { @@ -106,7 +108,8 @@ bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttrib AttributeStringPtr aStrAttr = std::dynamic_pointer_cast(theAttribute); if (!aStrAttr->isInitialized()) { - theError = "Attribute \"" + aStrAttr->id() + "\" is not initialized."; + theError = "Attribute \"%1\" is not initialized."; + theError.arg(aStrAttr->id()); return false; } bool isEmptyExpr = aStrAttr->value().empty(); diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 26ae2e277..6922bb6b4 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -529,7 +529,8 @@ bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute, Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 93152b1cb..9b3d82c82 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -50,7 +50,8 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -151,7 +152,8 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -182,29 +184,33 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute if (aRefFea->getKind() == SketchPlugin_Line::ID()) { if (aOtherFea->getKind() != SketchPlugin_Arc::ID() && aOtherFea->getKind() != SketchPlugin_Circle::ID()) { - theError = "It refers to a " + SketchPlugin_Line::ID() + ", but " + aParamA + " is neither an " - + SketchPlugin_Arc::ID() + " nor " + SketchPlugin_Circle::ID(); + theError = "It refers to a %1, but %2 is neither an %3 nor %4"; + theError.arg(SketchPlugin_Line::ID()).arg(aParamA) + .arg(SketchPlugin_Arc::ID()).arg(SketchPlugin_Circle::ID()); return false; } } else if (aRefFea->getKind() == SketchPlugin_Arc::ID()) { if (aOtherFea->getKind() != SketchPlugin_Line::ID() && aOtherFea->getKind() != SketchPlugin_Arc::ID()) { - theError = "It refers to an " + SketchPlugin_Arc::ID() + ", but " + aParamA + " is not a " - + SketchPlugin_Line::ID() + " or an " + SketchPlugin_Arc::ID(); + theError = "It refers to an %1, but %2 is not a %3 or an %4"; + theError.arg(SketchPlugin_Arc::ID()).arg(aParamA) + .arg(SketchPlugin_Line::ID()).arg(SketchPlugin_Arc::ID()); return false; } } else if (aRefFea->getKind() == SketchPlugin_Circle::ID()) { if (aOtherFea->getKind() != SketchPlugin_Line::ID()) { - theError = "It refers to an " + SketchPlugin_Circle::ID() + ", but " + aParamA + " is not a " - + SketchPlugin_Line::ID(); + theError = "It refers to an %1, but %2 is not a %3"; + theError.arg(SketchPlugin_Circle::ID()).arg(aParamA) + .arg(SketchPlugin_Line::ID()); return false; } } else { - theError = "It refers to " + aRefFea->getKind() + ", but should refer to " + SketchPlugin_Line::ID() - + " or " + SketchPlugin_Arc::ID() + " or " + SketchPlugin_Circle::ID(); + theError = "It refers to %1, but should refer to %2 or %3 or %4"; + theError.arg(aRefFea->getKind()).arg(SketchPlugin_Line::ID()) + .arg(SketchPlugin_Arc::ID()).arg(SketchPlugin_Circle::ID()); return false; } return true; @@ -222,7 +228,8 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute, Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -245,14 +252,16 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute, if (aRefAttr->object() == aRAttr->object()) { ObjectPtr anObject = aRefAttr->object(); std::string aName = anObject.get() ? anObject->data()->name() : ""; - theError = "The object " + aName + " has been already fixed."; + theError = "The object %1 has been already fixed."; + theError.arg(aName); return false; } } else if (aRefAttr->attr() == aRAttr->attr()) { AttributePtr anAttribute = aRefAttr->attr(); std::string aName = anAttribute.get() ? anAttribute->id() : ""; - theError = "The attribute " + aName + " has been already fixed."; + theError = "The attribute %1 has been already fixed."; + theError.arg(aName); return false; } } @@ -264,7 +273,8 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -298,9 +308,9 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, if (aFeature->getKind() != SketchPlugin_Line::ID() && aFeature->getKind() != SketchPlugin_Circle::ID() && aFeature->getKind() != SketchPlugin_Arc::ID()) { - theError = "The " + aFeature->getKind() + " feature kind of attribute is wrong. It should be " + - SketchPlugin_Line::ID() + " or " + SketchPlugin_Circle::ID() + " or " + - SketchPlugin_Arc::ID(); + theError = "The %1 feature kind of attribute is wrong. It should be %2 or %3 or %4"; + theError.arg(aFeature->getKind()).arg(SketchPlugin_Line::ID()) + .arg(SketchPlugin_Circle::ID()).arg(SketchPlugin_Arc::ID()); // wrong type of attribute return false; } @@ -308,7 +318,8 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, if ((aType[0] == SketchPlugin_Line::ID() || aType[1] == SketchPlugin_Line::ID()) && aType[0] != aType[1]) { - theError = "Feature with kinds " + aType[0] + " and " + aType[1] + "can not be equal."; + theError = "Feature with kinds %1 and %2 can not be equal."; + theError.arg(aType[0]).arg(aType[1]); return false; } return true; @@ -319,7 +330,8 @@ bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute, Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -336,7 +348,8 @@ bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute, std::list::iterator aMirIter = aMirroredObjects.begin(); for (; aMirIter != aMirroredObjects.end(); aMirIter++) if (aSelObject == *aMirIter) { - theError = "The object " + aName + " is a result of mirror"; + theError = "The object %1 is a result of mirror"; + theError.arg(aName); return false; } } @@ -348,7 +361,8 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -360,7 +374,8 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri FeaturePtr aConstraint = std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttrA = aConstraint->data()->refattr(aParamA); if (!aRefAttrA) { - theError = "The " + aParamA + " attribute " + " should be " + ModelAPI_AttributeRefAttr::typeId(); + theError = "The %1 attribute should be %2"; + theError.arg(aParamA).arg(ModelAPI_AttributeRefAttr::typeId()); return false; } @@ -372,12 +387,14 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri else { ObjectPtr anObject = aRefAttrA->object(); if (!anObject.get()) { - theError = aParamA + " attribute has an empty object"; + theError = "%1 attribute has an empty object"; + theError.arg(aParamA); return false; } FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttrA->object()); if (!aFeature.get()) { - theError = aParamA + " attribute has an empty feature"; + theError = "%1 attribute has an empty feature"; + theError.arg(aParamA); return false; } @@ -391,7 +408,8 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri else { FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttrB->object()); if (!aFeature) { - theError = theAttribute->id() + " attribute has an empty object"; + theError = "%1 attribute has an empty object"; + theError.arg(theAttribute->id()); return false; } if (aFeature->getKind() == SketchPlugin_Point::ID()) @@ -407,7 +425,8 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -435,7 +454,8 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, for (; anObjIter != aCopiedObjects.end(); anObjIter++) if (aSelObject == *anObjIter) { std::string aName = aSelObject.get() ? aSelObject->data()->name() : ""; - theError = "The object " + aName + " is a result of copy"; + theError = "The object %1 is a result of copy"; + theError.arg(aName); return false; } } @@ -678,7 +698,8 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttri Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -724,13 +745,15 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); AttributePtr anAttr = aRefAttr->attr(); if (!anAttr) { - theError = "The attribute " + theAttribute->id() + " should be a point"; + theError = "The attribute %1 should be a point"; + theError.arg(theAttribute->id()); return false; } @@ -740,7 +763,8 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri // selected point should not be a center of arc const std::string& aPntId = anAttr->id(); if (aPntId != SketchPlugin_Arc::START_ID() && aPntId != SketchPlugin_Arc::END_ID()) { - theError = "The attribute " + aPntId + " is not supported"; + theError = "The attribute %1 is not supported"; + theError.arg(aPntId); return false; } } @@ -748,12 +772,14 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri // selected point should be bound point of line const std::string& aPntId = anAttr->id(); if (aPntId != SketchPlugin_Line::START_ID() && aPntId != SketchPlugin_Line::END_ID()) { - theError = "The attribute " + aPntId + " is not supported"; + theError = "The attribute %1 is not supported"; + theError.arg(aPntId); return false; } } else { - theError = "Unable to build tangent arc on " + anAttrFeature->getKind(); + theError = "Unable to build tangent arc on %1"; + theError.arg(anAttrFeature->getKind()); return false; } @@ -778,7 +804,8 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } AttributeSelectionPtr aLineAttr = @@ -791,7 +818,8 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut } if (!anEdge || !anEdge->isLine()) { - theError = "The attribute " + theAttribute->id() + " should be a line"; + theError = "The attribute %1 should be a line"; + theError.arg(theAttribute->id()); return false; } @@ -824,7 +852,8 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, Events_InfoMessage& theError) const { if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; + theError = "The attribute with the %1 type is not processed"; + theError.arg(theAttribute->attributeType()); return false; } @@ -839,7 +868,8 @@ bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute, } if (!anEdge) { - theError = "The attribute " + theAttribute->id() + " should be an edge"; + theError = "The attribute %1 should be an edge"; + theError.arg(theAttribute->id()); return false; }