]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Validators return InfoMessage instead of string as an error
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 23 Jun 2016 14:33:12 +0000 (17:33 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 24 Jun 2016 06:42:57 +0000 (09:42 +0300)
62 files changed:
src/BuildPlugin/BuildPlugin_Validators.cpp
src/BuildPlugin/BuildPlugin_Validators.h
src/Config/Config_Translator.cpp
src/Config/Config_Translator.h
src/Events/Events_InfoMessage.h
src/ExchangePlugin/ExchangePlugin_Validators.cpp
src/ExchangePlugin/ExchangePlugin_Validators.h
src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.cpp
src/FeaturesPlugin/FeaturesPlugin_ValidatorTransform.h
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.h
src/GeomValidators/GeomValidators_BodyShapes.cpp
src/GeomValidators/GeomValidators_BodyShapes.h
src/GeomValidators/GeomValidators_BooleanArguments.cpp
src/GeomValidators/GeomValidators_BooleanArguments.h
src/GeomValidators/GeomValidators_ConstructionComposite.cpp
src/GeomValidators/GeomValidators_ConstructionComposite.h
src/GeomValidators/GeomValidators_Different.cpp
src/GeomValidators/GeomValidators_Different.h
src/GeomValidators/GeomValidators_DifferentShapes.cpp
src/GeomValidators/GeomValidators_DifferentShapes.h
src/GeomValidators/GeomValidators_Face.cpp
src/GeomValidators/GeomValidators_Face.h
src/GeomValidators/GeomValidators_FeatureKind.cpp
src/GeomValidators/GeomValidators_FeatureKind.h
src/GeomValidators/GeomValidators_Finite.cpp
src/GeomValidators/GeomValidators_Finite.h
src/GeomValidators/GeomValidators_IntersectionSelection.cpp
src/GeomValidators/GeomValidators_IntersectionSelection.h
src/GeomValidators/GeomValidators_MinObjectsSelected.cpp
src/GeomValidators/GeomValidators_MinObjectsSelected.h
src/GeomValidators/GeomValidators_PartitionArguments.cpp
src/GeomValidators/GeomValidators_PartitionArguments.h
src/GeomValidators/GeomValidators_Positive.cpp
src/GeomValidators/GeomValidators_Positive.h
src/GeomValidators/GeomValidators_ShapeType.cpp
src/GeomValidators/GeomValidators_ShapeType.h
src/GeomValidators/GeomValidators_ZeroOffset.cpp
src/GeomValidators/GeomValidators_ZeroOffset.h
src/Model/Model_AttributeValidator.cpp
src/Model/Model_AttributeValidator.h
src/Model/Model_FeatureValidator.cpp
src/Model/Model_FeatureValidator.h
src/Model/Model_Validator.cpp
src/Model/Model_Validator.h
src/ModelAPI/ModelAPI_AttributeValidator.h
src/ModelAPI/ModelAPI_FeatureValidator.h
src/ModelAPI/ModelAPI_Validator.h
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/ParametersPlugin/ParametersPlugin_EvalListener.cpp
src/ParametersPlugin/ParametersPlugin_Validators.cpp
src/ParametersPlugin/ParametersPlugin_Validators.h
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp
src/PartSet/PartSet_Validators.cpp
src/PartSet/PartSet_Validators.h
src/PartSet/PartSet_WidgetSketchCreator.cpp
src/SketchPlugin/SketchPlugin_ExternalValidator.cpp
src/SketchPlugin/SketchPlugin_ExternalValidator.h
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/SketchPlugin_Validators.h
src/XGUI/XGUI_ErrorDialog.cpp

index 234e697b2d7712f36986c76fca5aad3265a5b33c..9c2be0baebd25d48fe5a6cdff4da114cf3ec120a 100644 (file)
@@ -28,7 +28,7 @@
 //=================================================================================================
 bool BuildPlugin_ValidatorBaseForBuild::isValid(const AttributePtr& theAttribute,
                                                 const std::list<std::string>& theArguments,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   // Get base objects list.
   if(theAttribute->attributeType() != ModelAPI_AttributeSelectionList::typeId()) {
@@ -109,7 +109,7 @@ bool BuildPlugin_ValidatorBaseForBuild::isValid(const AttributePtr& theAttribute
 //=================================================================================================
 bool BuildPlugin_ValidatorBaseForWire::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const
+                                               Events_InfoMessage& theError) const
 {
   // Get attribute.
   if(theArguments.size() != 1) {
@@ -154,7 +154,7 @@ bool BuildPlugin_ValidatorBaseForWire::isNotObligatory(std::string theFeature, s
 //=================================================================================================
 bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const
+                                               Events_InfoMessage& theError) const
 {
   // Get attribute.
   if(theArguments.size() != 1) {
@@ -229,7 +229,7 @@ bool BuildPlugin_ValidatorBaseForFace::isNotObligatory(std::string theFeature, s
 //=================================================================================================
 bool BuildPlugin_ValidatorSubShapesSelection::isValid(const AttributePtr& theAttribute,
                                                       const std::list<std::string>& theArguments,
-                                                      std::string& theError) const
+                                                      Events_InfoMessage& theError) const
 {
   if(theArguments.size() != 1) {
     std::string aMsg = "Error: BuildPlugin_ValidatorSubShapesSelection should be used only with "
index 2bd253f9ddbc3736d4eeab108b6854fb5e0bb9c7..a72a882f1c6313c6f323d44c08e64cf7c82ed719 100644 (file)
@@ -23,7 +23,7 @@ public:
   //! \param[out] theError error message.
    virtual bool isValid(const AttributePtr& theAttribute,
                         const std::list<std::string>& theArguments,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 };
 
 /// \class BuildPlugin_ValidatorBaseForWire
@@ -39,7 +39,7 @@ public:
   //! \param theError error message.
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
@@ -58,7 +58,7 @@ public:
   //! \param theError error message.
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
@@ -76,7 +76,7 @@ public:
   //! \param[out] theError error message.
    virtual bool isValid(const AttributePtr& theAttribute,
                         const std::list<std::string>& theArguments,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 };
 
 #endif
index 1210b2bbc15683e89e61b7520d1b449fc6c88848..058acfca3c4bac28570093dbf517c89755494d7b 100644 (file)
@@ -101,15 +101,14 @@ bool Config_Translator::load(const std::string& theFileName)
   return true;
 }
 
-std::string Config_Translator::translate(std::shared_ptr<Events_InfoMessage> theInfo)
+std::string Config_Translator::translate(const Events_InfoMessage& theInfo)
 {
-  std::string aContext = theInfo->context();
-  std::string aMessage = theInfo->messageString();
-  std::list<std::string> aParameters = theInfo->parameters();
+  std::string aContext = theInfo.context();
+  std::string aMessage = theInfo.messageString();
+  std::list<std::string> aParameters = theInfo.parameters();
   return translate(aContext, aMessage, aParameters);
 }
 
-
 std::string insertParameters(const std::string& theString, const std::list<std::string>& theParams)
 {
   std::string aResult = theString;
index 6f79f81d1459a3e1548846d59f3d945de02599de..158091be3f6a79c96745b679e14507f3006e8184 100644 (file)
@@ -40,11 +40,11 @@ public:
 
   /**
   * Returns translation from the given info message.
-  * If transdlation is not exists then it returns a string 
+  * If translation is not exists then it returns a string
   * from the info data without translation
   * \param theInfo an info message
   */
-  static CONFIG_EXPORT std::string translate(std::shared_ptr<Events_InfoMessage> theInfo);
+  static CONFIG_EXPORT std::string translate(const Events_InfoMessage& theInfo);
 
   /**
   * Returns translation from the given data.
@@ -86,4 +86,4 @@ private:
 #endif
 };
 
-#endif
\ No newline at end of file
+#endif
index 959001c43283f6841cfc4a1ed96ba4f1a4f4c5c6..2924df181116796ad571560ac69f6508577cbdeb 100644 (file)
@@ -24,7 +24,7 @@ public:
 
   /// Constructor
   /// \param theSender a pointer on sender object
-  Events_InfoMessage(const void* theSender = 0):Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
+  explicit Events_InfoMessage(const void* theSender = 0):Events_Message(Events_Loop::eventByName("InfoMessage"), theSender) {}
 
   /// Constructor
   /// \param theSender a pointer on sender object
@@ -54,6 +54,15 @@ public:
   /// Returns message
   std::string messageString() const { return myMessage; }
 
+  Events_InfoMessage& operator=(const std::string& theMsg) {
+    setMessageString(theMsg);
+    return *this;
+  }
+
+  bool empty() const {
+    return myMessage.empty();
+  }
+
   /// Add parameter for message string of string type
   /// \param theParam the parameter
   void addParameter(const std::string& theParam) 
@@ -99,4 +108,4 @@ private:
   std::list<std::string> myParameters;
 };
 
-#endif
\ No newline at end of file
+#endif
index e08b9854aa48929e6f2c7cf7b659f335d3c88973..a0117d84ef3131ef50cdd11088287c60c8fb31cc 100644 (file)
@@ -8,6 +8,8 @@
 
 #include <ExchangePlugin_Tools.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Session.h>
@@ -39,7 +41,7 @@ bool ExchangePlugin_FormatValidator::parseFormats(const std::list<std::string>&
 
 bool ExchangePlugin_FormatValidator::isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const
+                                             Events_InfoMessage& theError) const
 {
   if (!theAttribute->isInitialized()) {
     theError = "Is not initialized.";
index ab1a142f9a2fb72b2450307987189a4ff7c15388..61613f35e50004742b7e535883d66b7905fb92f8 100644 (file)
@@ -35,7 +35,7 @@ public:
    */
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**
index 570d1fb6ffb385fd3a2b4d2f5034e0b4e7b0d4f3..9722f88361b267612baf4f5264c75aebe2b00975 100755 (executable)
@@ -2,6 +2,8 @@
 
 #include "FeaturesPlugin_ValidatorTransform.h"
 
+#include <Events_InfoMessage.h>
+
 #include "ModelAPI_AttributeSelectionList.h"
 #include "ModelAPI_ResultPart.h"
 #include "ModelAPI_ResultBody.h"
@@ -10,7 +12,7 @@
 
 bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute,
                                                 const std::list<std::string>& theArguments,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   bool aValid = true;
   std::string anAttributeType = theAttribute->attributeType();
index b957253e33c28bdd2766f7aea3f4ddcb679307ff..f57f2f9bdce6c46aaf9915df5846cdc247fb5f99 100755 (executable)
@@ -23,7 +23,7 @@ class FeaturesPlugin_ValidatorTransform : public ModelAPI_AttributeValidator
    */
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 #endif
index db8348cd2a1b8fd0af2099e061313b34b8cd0369..58c77cdd4a82a1a1593e1060691dce740e0781da 100644 (file)
@@ -8,6 +8,8 @@
 
 #include "FeaturesPlugin_Union.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeSelectionList.h>
@@ -38,7 +40,7 @@
 //==================================================================================================
 bool FeaturesPlugin_ValidatorPipePath::isValid(const AttributePtr& theAttribute,
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const
+                                               Events_InfoMessage& theError) const
 {
   AttributeSelectionPtr aPathAttrSelection = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
   if(!aPathAttrSelection.get()) {
@@ -64,7 +66,7 @@ bool FeaturesPlugin_ValidatorPipePath::isValid(const AttributePtr& theAttribute,
 //==================================================================================================
 bool FeaturesPlugin_ValidatorPipeLocations::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                     const std::list<std::string>& theArguments,
-                                                    std::string& theError) const
+                                                    Events_InfoMessage& theError) const
 {
   static const std::string aCreationMethodID = "creation_method";
   static const std::string aBaseObjectsID = "base_objects";
@@ -114,7 +116,7 @@ bool FeaturesPlugin_ValidatorPipeLocations::isNotObligatory(std::string theFeatu
 //==================================================================================================
 bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theAttribute,
                                                         const std::list<std::string>& theArguments,
-                                                        std::string& theError) const
+                                                        Events_InfoMessage& theError) const
 {
   if(theArguments.empty()) {
     theError = "Error: Validator parameters is empty.";
@@ -207,7 +209,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValid(const AttributePtr& theA
 //==================================================================================================
 bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const AttributePtr& theAttribute,
                                                                  const std::list<std::string>& theArguments,
-                                                                 std::string& theError) const
+                                                                 Events_InfoMessage& theError) const
 {
   if(!theAttribute.get()) {
     theError = "Error: Empty attribute.";
@@ -275,12 +277,14 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute
     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: ";
-      std::list<std::string>::const_iterator anIt = theArguments.cbegin();
-      theError += *anIt;
-      for(++anIt; anIt != theArguments.cend(); ++anIt) {
-        theError += ", " + *anIt;
+                 "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())
+          anArgumentString += ", ";
+        anArgumentString += *anIt;
       }
+      theError.arg(anArgumentString);
       return false;
     }
 
@@ -295,7 +299,7 @@ bool FeaturesPlugin_ValidatorBaseForGeneration::isValidAttribute(const Attribute
 //==================================================================================================
 bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theAttribute,
                                                         const std::list<std::string>& theArguments,
-                                                        std::string& theError) const
+                                                        Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) {
     theError = "Error: The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -340,7 +344,7 @@ bool FeaturesPlugin_ValidatorCompositeLauncher::isValid(const AttributePtr& theA
 //==================================================================================================
 bool FeaturesPlugin_ValidatorExtrusionDir::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                  const std::list<std::string>& theArguments,
-                                                 std::string& theError) const
+                                                 Events_InfoMessage& theError) const
 {
   if(theArguments.size() != 2) {
     theError = "Error: Validator should be used with 2 parameters for extrusion.";
@@ -427,7 +431,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isNotObligatory(std::string theFeatur
 
 //==================================================================================================
 bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty(const AttributePtr& theAttribute,
-                                                            std::string& theError) const
+                                                              Events_InfoMessage& theError) const
 {
   if(!theAttribute.get()) {
     return true;
@@ -474,7 +478,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isShapesCanBeEmpty(const AttributePtr
 //==================================================================================================
 bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAttribute,
                                                        const std::list<std::string>& theArguments,
-                                                       std::string& theError) const
+                                                       Events_InfoMessage& theError) const
 {
   AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
   if(!anAttrSelectionList.get()) {
@@ -536,7 +540,7 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt
 //==================================================================================================
 bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& theAttribute,
                                                          const std::list<std::string>& theArguments,
-                                                         std::string& theError) const
+                                                         Events_InfoMessage& theError) const
 {
   AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
   if(!anAttrSelectionList.get()) {
@@ -580,7 +584,7 @@ bool FeaturesPlugin_ValidatorPartitionSelection::isValid(const AttributePtr& the
 //==================================================================================================
 bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(const AttributePtr& theAttribute,
                                                                const std::list<std::string>& theArguments,
-                                                               std::string& theError) const
+                                                               Events_InfoMessage& theError) const
 {
   AttributeSelectionListPtr aSubShapesAttrList = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
   if(!aSubShapesAttrList.get()) {
@@ -633,7 +637,7 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(const AttributePt
 //==================================================================================================
 bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                             const std::list<std::string>& theArguments,
-                                                            std::string& theError) const
+                                                            Events_InfoMessage& theError) const
 {
   static const std::string aBaseShapeID = "base_shape";
   static const std::string aSubShapesID = "subshapes";
@@ -689,7 +693,7 @@ bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isNotObligatory(std::string
 //==================================================================================================
 bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttribute,
                                                      const std::list<std::string>& theArguments,
-                                                     std::string& theError) const
+                                                     Events_InfoMessage& theError) const
 {
   AttributeSelectionListPtr aBaseObjectsAttrList = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
   if(!aBaseObjectsAttrList.get()) {
@@ -716,7 +720,7 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr
 //==================================================================================================
 bool FeaturesPlugin_ValidatorUnionArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                      const std::list<std::string>& theArguments,
-                                                     std::string& theError) const
+                                                     Events_InfoMessage& theError) const
 {
   // Check feature kind.
   if(theFeature->getKind() != FeaturesPlugin_Union::ID()) {
index c806e754b8957904b3a62167aee37b7cbe09d91c..ce3fe042e3ad7186f09a797555a2c250aa6275da 100644 (file)
@@ -22,7 +22,7 @@ public:
   //! \param[out] theError error message.
    virtual bool isValid(const AttributePtr& theAttribute,
                         const std::list<std::string>& theArguments,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorPipeLocations
@@ -37,7 +37,7 @@ class FeaturesPlugin_ValidatorPipeLocations: public ModelAPI_FeatureValidator
   //! \param theError error message
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// Returns true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
@@ -56,12 +56,12 @@ public:
   //! \param[out] theError error message.
    virtual bool isValid(const AttributePtr& theAttribute,
                         const std::list<std::string>& theArguments,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 
 private:
   bool isValidAttribute(const AttributePtr& theAttribute,
                         const std::list<std::string>& theArguments,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorCompositeLauncher
@@ -76,7 +76,7 @@ public:
   //! \param[out] theError error message.
    virtual bool isValid(const AttributePtr& theAttribute,
                         const std::list<std::string>& theArguments,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorExtrusionDir
@@ -92,14 +92,14 @@ public:
   //! \param[out] theError error message.
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
 
 private:
   bool isShapesCanBeEmpty(const AttributePtr& theAttribute,
-                          std::string& theError) const;
+                          Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorBooleanSelection
@@ -115,7 +115,7 @@ public:
   /// \param[out] theError error message.
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorPartitionSelection
@@ -131,7 +131,7 @@ public:
   /// \param[out] theError error message.
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection
@@ -147,7 +147,7 @@ public:
   /// \param[out] theError error message.
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorRemoveSubShapesResult
@@ -162,7 +162,7 @@ class FeaturesPlugin_ValidatorRemoveSubShapesResult: public ModelAPI_FeatureVali
   //! \param theError error message
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
@@ -181,7 +181,7 @@ public:
   /// \param[out] theError error message.
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /// \class FeaturesPlugin_ValidatorUnionArguments
@@ -196,7 +196,7 @@ class FeaturesPlugin_ValidatorUnionArguments: public ModelAPI_FeatureValidator
   //! \param theError error message
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
index 18bd9918a59949e9634eda8708923eb10f27695a..a681fbe5d19f7983ec4aaca653ab040fca7e29e8 100644 (file)
@@ -6,13 +6,15 @@
 
 #include "GeomValidators_BodyShapes.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_ResultConstruction.h>
 
 bool GeomValidators_BodyShapes::isValid(const AttributePtr& theAttribute,
                                         const std::list<std::string>& theArguments,
-                                        std::string& theError) const
+                                        Events_InfoMessage& theError) const
 {
   std::string anAttributeType = theAttribute->attributeType();
   if(anAttributeType == ModelAPI_AttributeSelection::typeId()) {
index 33e2f8f504bc240ad219711b86fc9f3b219562e5..5058cfcb8ef1ac4a2e70ba9d50d41f6c225b5682 100644 (file)
@@ -25,7 +25,7 @@ public:
   /// \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index b54344510c0a0be1fc56640cfabd15685172529f..1db13e60781757bc3043e877fe1bb9da7beaa294 100644 (file)
@@ -6,13 +6,15 @@
 
 #include <GeomValidators_BooleanArguments.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeSelectionList.h>
 
 //=================================================================================================
 bool GeomValidators_BooleanArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                               const std::list<std::string>& theArguments,
-                                              std::string& theError) const
+                                              Events_InfoMessage& theError) const
 {
   if(theArguments.size() != 3) {
     theError = "Wrong number of arguments (expected 3).";
index 1686c8ee4e13c1429e47a26cdf2dcc8b418667fe..42a46d53a2d6ae91c20c59e2019431050106fd38 100644 (file)
@@ -26,7 +26,7 @@ public:
    */
   GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution.
   GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
index b19719831ce1846d1ba90a5c928e46f00769f1ee..c748c2cdc18ea11a82e14a9d497619c998facadb 100644 (file)
@@ -2,13 +2,15 @@
 
 #include "GeomValidators_ConstructionComposite.h"
 
+#include <Events_InfoMessage.h>
+
 #include "ModelAPI_AttributeSelection.h"
 #include "ModelAPI_ResultConstruction.h"
 #include "ModelAPI_CompositeFeature.h"
 
 bool GeomValidators_ConstructionComposite::isValid(const AttributePtr& theAttribute,
                                                    const std::list<std::string>& theArguments,
-                                                   std::string& theError) const
+                                                   Events_InfoMessage& theError) const
 {
   bool aValid = true;
   if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
index fb37f95bc55a2e8ac63ae63cf0fc060ce8a21f90..67a2a3a30f84d167dcb2aaaeb75f69b4c862b996 100644 (file)
@@ -24,7 +24,7 @@ class GeomValidators_ConstructionComposite : public ModelAPI_AttributeValidator
   //! \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index 94c369c5a516f796d1c6f4f8fe9023901ddd3a25..617161f9c1624faad28e75b0ceaab38191e0c956 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <GeomValidators_Different.h>
 
+#include <Events_InfoMessage.h>
+
 #include <GeomDataAPI_Point2D.h>
 #include <GeomAPI_Pnt2d.h>
 
@@ -54,7 +56,7 @@ public:
 
 bool GeomValidators_Different::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                        const std::list<std::string>& theArguments,
-                                       std::string& theError) const
+                                       Events_InfoMessage& theError) const
 {
   std::map<std::string, std::list<AttributePtr> > anAttributesMap;
   // For all attributes referred by theArguments 
index a5be84f7baef37521b22b83551d27c38dba4184d..e5d7e15bf5ddb7f5177af0bd564c0e996e4b0424 100644 (file)
@@ -26,7 +26,7 @@ public:
    */
   GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 
   GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
 };
index e9470daf4b6fea239ccbcc8e2b523bd86c63e63b..7eefe262663b1b5f9040fc9ad404c48e531aa227 100644 (file)
@@ -6,12 +6,14 @@
 
 #include "GeomValidators_DifferentShapes.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeSelection.h>
 #include "ModelAPI_Object.h"
 
 bool GeomValidators_DifferentShapes::isValid(const AttributePtr& theAttribute,
                                       const std::list<std::string>& theArguments,
-                                      std::string& theError) const
+                                      Events_InfoMessage& theError) const
 {
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
   AttributeSelectionPtr aSelectionAttribute = 
index ac3dd5b581a9bbd3fa90dc701585cc645abe9640..2bfef97119736ddd2a9480f3789ed5eaeeea103c 100644 (file)
@@ -25,7 +25,7 @@ public:
   /// \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index f91066da277bdea6b64fcf8cb859b36b40a48773..391ae4f827232caa1f05d6dd197d5d13112aaa7a 100644 (file)
@@ -34,7 +34,7 @@ GeomAbs_SurfaceType faceType(const std::string& theType)
 
 bool GeomValidators_Face::isValid(const AttributePtr& theAttribute,
                                   const std::list<std::string>& theArguments,
-                                  std::string& theError) const
+                                  Events_InfoMessage& theError) const
 {
   std::string anAttributeType = theAttribute->attributeType();
   if (anAttributeType != ModelAPI_AttributeSelection::typeId()) {
index f547dbb47f5f4124e7a2a16d65b6df09c3862db1..c3b802658753e6f1a0a1db2c34da281f2ef0e9a0 100644 (file)
@@ -24,7 +24,7 @@ class GeomValidators_Face : public ModelAPI_AttributeValidator
   //! \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index 9c663a1f7984925943fc3daa2b6c2f2a256ac018..c6036e4146ea560d54edc4f75b5e94d266ba1ac3 100755 (executable)
@@ -6,6 +6,8 @@
 
 #include "GeomValidators_FeatureKind.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_AttributeRefAttr.h>
@@ -19,7 +21,7 @@
 
 bool GeomValidators_FeatureKind::isValid(const AttributePtr& theAttribute,
                                       const std::list<std::string>& theArguments,
-                                      std::string& theError) const
+                                      Events_InfoMessage& theError) const
 {
   bool isSketchEntities = true;
   std::set<std::string> anEntityKinds;
index 89499275371d48ae8b613ea92c7840dee72bbeb1..4884aed1d27e2a8f88d723f1a15f8664c5d92f1d 100755 (executable)
@@ -25,7 +25,7 @@ public:
   /// \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index 150415cb15428553ea4251af95169b2f0ac99e92..6668b8bbae9b06bba33d9c59088899b9dc69fcd7 100755 (executable)
@@ -6,12 +6,14 @@
 
 #include <GeomValidators_Finite.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_ResultConstruction.h>
 
 bool GeomValidators_Finite::isValid(const AttributePtr& theAttribute,
                                    const std::list<std::string>& theArguments,
-                                   std::string& theError) const
+                                   Events_InfoMessage& theError) const
 {
   bool aValid = true;
 
index 85b5b9803730fb806d775292833165fa2a9d0e61..78c6b7c45c0cb625da40ffa1f6a7fcdb783025b2 100755 (executable)
@@ -23,7 +23,7 @@ public:
   //! \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index e3899d7f53ec0267282ccaa7f5673b4e9c51c565..ec2a886e0e8b687b69469f670c1e4c664580b55c 100644 (file)
@@ -6,13 +6,15 @@
 
 #include "GeomValidators_IntersectionSelection.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_Feature.h>
 
 bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttribute,
                                                    const std::list<std::string>& theArguments,
-                                                   std::string& theError) const
+                                                   Events_InfoMessage& theError) const
 {
   if(!theAttribute.get()) {
     theError = "Error: empty selection.";
@@ -40,9 +42,8 @@ bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttrib
     if(aFeatureKind == "Sketch" ||
        aFeatureKind == "Plane" ||
        aFeatureKind == "Axis") {
-      theError = "Error: ";
-      theError += aFeatureKind;
-      theError += " shape is not allowed for selection.";
+      theError = "Error: %1 shape is not allowed for selection.";
+      theError.arg(aFeatureKind);
       return false;
     }
     std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
index 35a78c04b510f616dff733bbcc45dd4657552891..b3de2da039a223963ee54f71faba8f4a9277fa1a 100644 (file)
@@ -25,7 +25,7 @@ public:
   /// \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 };
 
 #endif
index 58e39b3a0d07bafee932835d57cbddefcb8ccae0..aa4088daa7420b72710b4fad193b75c60c126402 100644 (file)
@@ -6,13 +6,15 @@
 
 #include <GeomValidators_MinObjectsSelected.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeSelectionList.h>
 
 //=================================================================================================
 bool GeomValidators_MinObjectsSelected::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                 const std::list<std::string>& theArguments,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   if(theArguments.size() != 2) {
     theError = "Error: Wrong number of arguments (expected 2): selection list id and min number of objects";
index cdcb20a27767e5280839ce33eb89f6092a6e1a19..27f860c8184bdc9fa8202374dc8632de7f47489b 100644 (file)
@@ -24,7 +24,7 @@ public:
   /// \returns true if feature is valid.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution.
   GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
index e94ebca48b78788a4b3c0442be57141118d86b4d..9d017b017e3857fb9a285735af85bf8bc115580b 100644 (file)
@@ -6,13 +6,15 @@
 
 #include <GeomValidators_PartitionArguments.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeSelectionList.h>
 
 //=================================================================================================
 bool GeomValidators_PartitionArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                               const std::list<std::string>& theArguments,
-                                              std::string& theError) const
+                                              Events_InfoMessage& theError) const
 {
   if(theArguments.size() != 3) {
     theError = "Wrong number of arguments (expected 3).";
index 1b32070018ee69f2f5d49f193f714b725f0e2589..6d7c3a8336d623f7c7efbe08d84095fcd51b6a09 100644 (file)
@@ -26,7 +26,7 @@ public:
    */
   GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution.
   GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
index b127ffe033a688edf64981f0c222287d5ea8cb71..17c38fb19035600799d5bb7808f814aa15b43347 100644 (file)
@@ -5,6 +5,9 @@
 // Author:      Mikhail PONIKAROV
 
 #include "GeomValidators_Positive.h"
+
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_Session.h>
@@ -25,7 +28,7 @@ GeomValidators_Positive::GeomValidators_Positive()
 
 bool GeomValidators_Positive::isValid(const AttributePtr& theAttribute, 
                                       const std::list<std::string>& theArguments,
-                                      std::string& theError) const
+                                      Events_InfoMessage& theError) const
 {
   double aMinValue = 1.e-5;
   if(theArguments.size() == 1) {
index 0e15c77d27a5a2101099ff33eabe328f91179227..08a30d288c1c59b8e13fbb5d9ab23fd8eb58faec 100644 (file)
@@ -24,7 +24,7 @@ public:
   //! \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 
 };
 
index 8bc0d9fbdd6c9db30d44e7c08dae6d69ca80ea69..2027c50ea860424fb6bb730be20492c9dda18b5b 100755 (executable)
@@ -64,7 +64,7 @@ std::string getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape&
 
 bool GeomValidators_ShapeType::isValid(const AttributePtr& theAttribute,
                                        const std::list<std::string>& theArguments,
-                                       std::string& theError) const
+                                       Events_InfoMessage& theError) const
 {
   bool aValid = false;
 
@@ -99,7 +99,7 @@ bool GeomValidators_ShapeType::isValid(const AttributePtr& theAttribute,
 
 bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute,
                                                 const TypeOfShape theShapeType,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   bool aValid = true;
 
@@ -160,7 +160,7 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
 
 bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
                                              const TypeOfShape theShapeType,
-                                             std::string& theError) const
+                                             Events_InfoMessage& theError) const
 {
   bool aValid = true;
   if (!theObject.get()) {
@@ -191,7 +191,7 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
 
 bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
                                             const TypeOfShape theShapeType,
-                                            std::string& theError) const
+                                            Events_InfoMessage& theError) const
 {
   bool aValid = true;
 
index 3d2c60e65b9557f83ab0a36b96ed93ee47db88e6..0146cfda77f1779e008fa0534b627129836e1fbb 100644 (file)
@@ -49,7 +49,7 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator
   //! \param[out] theError error message.
   GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 protected:
   /// Convert string to TypeOfShape value
   /// \param theType a string value
@@ -61,7 +61,7 @@ protected:
   /// \param[out] theError error message.
   bool isValidAttribute(const AttributePtr& theAttribute,
                         const TypeOfShape theShapeType,
-                        std::string& theError) const;
+                        Events_InfoMessage& theError) const;
 
   /// Returns true if the attibute's object type satisfies the argument value
   /// \param[in] theObject a checked object
@@ -69,7 +69,7 @@ protected:
   /// \param[out] theError error message.
   bool isValidObject(const ObjectPtr& theObject,
                      const TypeOfShape theShapeType,
-                     std::string& theError) const;
+                     Events_InfoMessage& theError) const;
 
   /// Returns true if the attibute's object type satisfies the argument value
   /// \param[in] theShape a checked shape
@@ -77,7 +77,7 @@ protected:
   /// \param[out] theError error message.
   bool isValidShape(const GeomShapePtr theShape,
                     const TypeOfShape theShapeType,
-                    std::string& theError) const;
+                    Events_InfoMessage& theError) const;
 
 };
 
index f898a2297b219ba1f5b5066b754a95cfdabec6c6..20d324edd59db1d70acaf4c152607a02cf6b75fd 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <GeomValidators_ZeroOffset.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeSelectionList.h>
@@ -21,7 +23,7 @@
 //=================================================================================================
 bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                         const std::list<std::string>& theArguments,
-                                        std::string& theError) const
+                                        Events_InfoMessage& theError) const
 {
   if(theArguments.size() != 9) {
     theError = "Wrong number of validator arguments in xml(expected 9).";
index 64fd4ab63ee15a425a0cb5aaf432b782d697c51d..3d5c3b864178d6ac94adba36cdb0ebec0f00bb15 100644 (file)
@@ -26,7 +26,7 @@ public:
    */
   GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const;
+                                             Events_InfoMessage& theError) const;
 
   /// \return true if the attribute in feature is not obligatory for the feature execution.
   GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
index 93e32183232445a6c22320e974106e371cdd34f6..8cf60192156bcaea33cb567c18e84b9f65d4634d 100644 (file)
@@ -6,6 +6,8 @@
 
 #include "Model_AttributeValidator.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeInteger.h>
 
@@ -14,7 +16,7 @@
 
 bool Model_AttributeValidator::isValid(const AttributePtr& theAttribute, 
                                        const std::list<std::string>& theArguments, 
-                                       std::string& theError) const
+                                       Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() == ModelAPI_AttributeInteger::typeId()) {
     AttributeIntegerPtr anAttribue =
index 3e8240cdf1c3549c26d46b53a482972e7f2c6875..0379fbe4e391565cfb3036b0176f13dcc9d9b7fb 100644 (file)
@@ -26,7 +26,7 @@ public:
   /// \returns true if attribute is valid
   MODEL_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                     const std::list<std::string>& theArguments,
-                                    std::string& theError) const;
+                                    Events_InfoMessage& theError) const;
 };
 
 #endif // Model_AttributeValidator_H
index 303a465676c90fe08fc484e5a8689856d86db470..06923d32449fc6579c0b66fbae1df529abef5cee 100644 (file)
@@ -5,6 +5,9 @@
 // Author:      Vitaly SMETANNIKOV
 
 #include <Model_FeatureValidator.h>
+
+#include <Events_InfoMessage.h>
+
 #include <Model_Validator.h>
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_Data.h>
@@ -17,7 +20,7 @@
 
 bool Model_FeatureValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                      const std::list<std::string>& theArguments,
-                                     std::string& theError) const
+                                     Events_InfoMessage& theError) const
 {
   static Model_ValidatorsFactory* aValidators = 
     static_cast<Model_ValidatorsFactory*>(ModelAPI_Session::get()->validators());
index 010ad505c6cf9667df9088be8b8d77042856b527..47c091937927bfe3dbc9e51ff6dcd55ded887a23 100644 (file)
@@ -35,7 +35,7 @@ public:
   /// \returns true if feature is valid
   MODEL_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                     const std::list<std::string>& theArguments,
-                                    std::string& theError) const;
+                                    Events_InfoMessage& theError) const;
 
   /// sets not obligatory attributes, not checked for initialization
   virtual void registerNotObligatory(std::string theFeature, std::string theAttribute);
index dafa195830c7b5e6dcd6f439ecf1168f900d3cf2..1d420229faaad2c2985c8d6e2163cba9b8337971 100644 (file)
@@ -177,12 +177,12 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>&
       const ModelAPI_FeatureValidator* aFValidator = 
         dynamic_cast<const ModelAPI_FeatureValidator*>(validator(aValidatorID));
       if (aFValidator) {
-        std::string anError;
+        Events_InfoMessage anError;
         if (!aFValidator->isValid(theFeature, anArguments, anError)) {
           if (anError.empty())
             anError = "Unknown error.";
-          anError = aValidatorID + ": " + anError;
-          theFeature->setError(anError, false);
+          anError = aValidatorID + ": " + anError.messageString();
+          theFeature->setError(anError.messageString(), false);
           theFeature->data()->execState(ModelAPI_StateInvalidArgument);
           return false;
         }
@@ -221,12 +221,12 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>&
     AttributePtr anAttribute = theFeature->data()->attribute(anAttributeID);
 
     std::string aValidatorID;
-    std::string anError;
+    Events_InfoMessage anError;
     if (!validate(anAttribute, aValidatorID, anError)) {
       if (anError.empty())
         anError = "Unknown error.";
-      anError = anAttributeID + " - " + aValidatorID + ": " + anError;
-      theFeature->setError(anError, false);
+      anError = anAttributeID + " - " + aValidatorID + ": " + anError.messageString();
+      theFeature->setError(anError.messageString(), false);
       theFeature->data()->execState(ModelAPI_StateInvalidArgument);
       return false;
     } 
@@ -237,7 +237,7 @@ bool Model_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>&
 
 bool Model_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Attribute>& theAttribute,
                                        std::string& theValidator,
-                                       std::string& theError) const
+                                       Events_InfoMessage& theError) const
 {
   FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
   if (!aFeature.get()) {
index 0040d8c2b2c2c0c11e363549fc804c100d6be135..2fd016478963d1f9f58fd5f11707297330d68c12 100644 (file)
@@ -78,7 +78,7 @@ class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory
 
   /// Returns true if the attribute is valid.
   MODEL_EXPORT virtual bool validate(const std::shared_ptr<ModelAPI_Attribute>& theAttribute,
-                                     std::string& theValidator, std::string& theError) const;
+                                     std::string& theValidator, Events_InfoMessage& theError) const;
 
   /// register that this attribute in feature is not obligatory for the feature execution
   /// so, it is not needed for the standard validation mechanism
index 142c91c233689bb32a729ca6e232263c3b8b2a9f..54e5679ece209378eba52b369a08c9c957142606 100644 (file)
@@ -23,7 +23,7 @@ public:
   //! \param theError the error string message if validation fails
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const = 0;
+                       Events_InfoMessage& theError) const = 0;
 
   MODELAPI_EXPORT ~ModelAPI_AttributeValidator();
 };
index f051c1e0d4a27e23bf64baea4e3cf12f755a7b19..3b995c6c150a396758c113e5e0d3964a0610bbe3 100644 (file)
@@ -32,7 +32,7 @@ class MODELAPI_EXPORT ModelAPI_FeatureValidator : public ModelAPI_Validator
   /// \param theError the error string message if validation fails
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const = 0;
+                       Events_InfoMessage& theError) const = 0;
 
   /// Returns true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute) = 0;
index af9eb2839e8ec56e01325982b97dfd7713fc17f9..7fddb71ac6a366e4516074e2c19f1e6e871d1319 100644 (file)
@@ -13,6 +13,7 @@
 #include <list>
 
 class ModelAPI_Feature;
+class Events_InfoMessage;
 
 /**\class ModelAPI_Validator
  * \ingroup DataModel
@@ -84,7 +85,7 @@ class MODELAPI_EXPORT ModelAPI_ValidatorsFactory
 
   /// Returns true if the attribute is valid.
   virtual bool validate(const std::shared_ptr<ModelAPI_Attribute>& theAttribute,
-                        std::string& theValidator, std::string& theError) const = 0;
+                        std::string& theValidator, Events_InfoMessage& theError) const = 0;
 
   /// register that this attribute in feature is not obligatory for the feature execution
   /// so, it is not needed for the standard validation mechanism
index ba49483764657583320424eb92c0e78903bb9ba9..69cd60c463ba29b321ad6d99cf508fe7c15fb82a 100644 (file)
@@ -9,6 +9,8 @@
 #include "ModuleBase_Tools.h"
 #include "ModuleBase_WidgetValidator.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_Events.h>
@@ -121,16 +123,21 @@ QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const
     return anError;
 
   std::string aValidatorID;
-  std::string anErrorMsg;
+  Events_InfoMessage anErrorMsg;
 
   static ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
   if (!aValidators->validate(anAttribute, aValidatorID, anErrorMsg)) {
     if (anErrorMsg.empty())
       anErrorMsg = "unknown error.";
-    anErrorMsg = anAttributeID + " - " + aValidatorID + ": " + anErrorMsg;
+    anErrorMsg = anAttributeID + " - " + aValidatorID + ": " + anErrorMsg.messageString();
+  }
+
+  if (!anErrorMsg.empty()) {
+    std::string aStr = Config_Translator::translate(anErrorMsg);
+    std::string aCodec = Config_Translator::codec(anErrorMsg.context());
+    anError = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aStr.c_str());
   }
 
-  anError = QString::fromStdString(anErrorMsg);
   if (anError.isEmpty() && theValueStateChecked)
     anError = getValueStateError();
 
index fd5e7e96a58bfbbb990489fd111b600ce8270e1d..daecef19f35de242812527ed9bbc41ff5ed22cdf 100644 (file)
@@ -7,6 +7,8 @@
 #include <ModuleBase_WidgetSelectorStore.h>
 #include <ModuleBase_ViewerPrs.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_AttributeValidator.h>
@@ -190,7 +192,8 @@ bool ModuleBase_WidgetValidated::isValidAttribute(const AttributePtr& theAttribu
 {
   SessionPtr aMgr = ModelAPI_Session::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
-  std::string aValidatorID, anError;
+  std::string aValidatorID;
+  Events_InfoMessage anError;
   return aFactory->validate(theAttribute, aValidatorID, anError);
 }
 
index c2deeff2d25cce8c1a082e83d0ef892c18e7b5d2..d63741c9fa606596f832c40bd95ddb6524d0b2ac 100644 (file)
@@ -338,7 +338,8 @@ void ParametersPlugin_EvalListener::renameInDependents(std::shared_ptr<ModelAPI_
 
 bool isValidAttribute(const AttributePtr& theAttribute)
 {
-  std::string aValidator, anError;
+  std::string aValidator;
+  Events_InfoMessage anError;
   return ModelAPI_Session::get()->validators()->validate(theAttribute, aValidator, anError);
 }
 
index d751c36bae268a1369436ca1c95d3eacb03e4cfe..ec550aecaad95bd2be334bddbff623d9fc6eed91 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <ParametersPlugin_Parameter.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_ResultParameter.h>
@@ -24,7 +26,7 @@ ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator()
 
 bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribute,
                                                  const std::list<std::string>& theArguments,
-                                                 std::string& theError) const
+                                                 Events_InfoMessage& theError) const
 {
   AttributeStringPtr aStrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
   if (!aStrAttr->isInitialized()) {
@@ -95,7 +97,7 @@ ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator()
 
 bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttribute,
                                                    const std::list<std::string>& theArguments,
-                                                   std::string& theError) const
+                                                   Events_InfoMessage& theError) const
 {
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
   ResultParameterPtr aParam =
index cc1812abc711f87bad0424fdef8590ea2b8d5ce0..421c681b33f8f8651650b52702b60894ba965649 100644 (file)
@@ -34,7 +34,7 @@ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator
    */
   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const;
+                                               Events_InfoMessage& theError) const;
 
  protected:
   /// Returns true if theString is a valid variable name.
@@ -63,7 +63,7 @@ class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator
    */
   PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const;
+                                               Events_InfoMessage& theError) const;
 };
 
 
index 35df874aa38e0c19babc2394b6a69b2e2c839578..7ab7fbf7397719ec3d2415bcbae757fa19af5fe2 100644 (file)
@@ -8,6 +8,8 @@
 #include "ParametersPlugin_Parameter.h"
 #include "ParametersPlugin_Validators.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_ResultParameter.h>
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeRefList.h>
@@ -252,11 +254,12 @@ bool ParametersPlugin_WidgetParamsMgr::storeValueCustom()
   ParametersPlugin_ExpressionValidator aValidator;
   std::list<std::string> aArgs;
   std::string aAttrId = ParametersPlugin_Parameter::VARIABLE_ID();
-  std::string aErr;
+  Events_InfoMessage aErr;
   int aId = 0;
   foreach(FeaturePtr aFeature, myParametersList) {
     if (!aValidator.isValid(aFeature->attribute(aAttrId), aArgs, aErr)) {
-      QMessageBox::warning(this, tr("Warning"), aErr.c_str());
+      // TODO(spo): translate
+      QMessageBox::warning(this, tr("Warning"), aErr.messageString().c_str());
       selectItemScroll(myParameters->child(aId));
       return false;
     }
index 9766c0a9ee319424ef0817137272855b5e09d99a..26ae2e27737535f9b5175c36cc5c0f2b90999db9 100755 (executable)
@@ -19,6 +19,8 @@
 #include <ModuleBase_OperationFeature.h>
 #include <ModuleBase_ViewerPrs.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeReference.h>
@@ -354,7 +356,7 @@ std::string PartSet_DifferentObjectsValidator::errorMessage(
 
 bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute, 
                                                 const std::list<std::string>& theArguments,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
 
@@ -524,7 +526,7 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
 
 bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute, 
                                      const std::list<std::string>& theArguments,
-                                     std::string& theError) const
+                                     Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
index 2111ef63d94e310fd8357066635b318a17e68952..0b25943aabdd08c49a4112e6ae90253243de9139 100644 (file)
@@ -154,7 +154,7 @@ class PartSet_DifferentObjectsValidator : public ModelAPI_AttributeValidator
   //! \param theError an output error string
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 private:
   //! Returns error message for the error type
   //! \param theType a type of error
@@ -179,7 +179,7 @@ class PartSet_CoincidentAttr : public ModelAPI_AttributeValidator
   //! \param theError an output error string
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 
index 8daeb546d92511fab4e0af759018d5ddc860cb1a..c4035cc22e1a565b98e92ed14dd95a1190c8f7dd 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <GeomAPI_Face.h>
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_AttributeSelection.h>
@@ -461,7 +463,8 @@ void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp)
         SessionPtr aMgr = ModelAPI_Session::get();
         ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
         AttributePtr anAttribute = myFeature->attribute(anObjectsAttribute);
-        std::string aValidatorID, anError;
+        std::string aValidatorID;
+        Events_InfoMessage anError;
         aSelList->append(aRes, GeomShapePtr());
         if (aFactory->validate(anAttribute, aValidatorID, anError))
           updateObject(aCompFeature);
@@ -479,12 +482,14 @@ bool PartSet_WidgetSketchCreator::validateSelectionList() const
 
   SessionPtr aMgr = ModelAPI_Session::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
-  std::string aValidatorID, anError;
+  std::string aValidatorID;
+  Events_InfoMessage anError;
   bool isValidPComposite = aFactory->validate(anAttrList, aValidatorID, anError);
   if (!isValidPComposite) {
     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
+    // TODO(spo): translate
     QMessageBox::question(aWorkshop->desktop(), tr("Apply current feature"),
-                  tr("Sketch is invalid and will be deleted.\nError: %1").arg(anError.c_str()),
+                  tr("Sketch is invalid and will be deleted.\nError: %1").arg(anError.messageString().c_str()),
                   QMessageBox::Ok);
   }
   return isValidPComposite;
index 362dd94f17ab09068ada469ed648c244b79ec54f..9c9fc3345d4ecdcb345a66742990301d860d4d81 100644 (file)
@@ -7,6 +7,8 @@
 #include "SketchPlugin_ExternalValidator.h"
 #include "SketchPlugin_Feature.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Tools.h>
@@ -14,7 +16,7 @@
 
 bool SketchPlugin_ExternalValidator::isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const
+                                             Events_InfoMessage& theError) const
 {
   if (theArguments.size() != 1)
     return true;
index 821b27de77b9c3cd5ea2247d55deb25cbe8edea1..303e626506105ed3253cd3a0fb103f4f7c274300 100644 (file)
@@ -26,7 +26,7 @@ public:
   /// \param theError error message
   SKETCHPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
                                            const std::list<std::string>& theArguments,
-                                           std::string& theError) const;
+                                           Events_InfoMessage& theError) const;
 
 protected:
   /// returns true if the feature of the attribute is external
index c2f1badd67199669600053b2a2847481d750fdda..93152b1cb18ce8fe8493b39e53a95f480cbaef92 100755 (executable)
@@ -20,6 +20,8 @@
 
 #include "SketcherPrs_Tools.h"
 
+#include <Events_InfoMessage.h>
+
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_AttributeDouble.h>
@@ -45,7 +47,7 @@ const double tolerance = 1.e-7;
 
 bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribute, 
                                                  const std::list<std::string>& theArguments,
-                                                 std::string& theError) const
+                                                 Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -70,7 +72,7 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut
       dynamic_cast<const ModelAPI_AttributeValidator*>(aFactory->validator("GeomValidators_ShapeType"));
     std::list<std::string> anArguments;
     anArguments.push_back("circle");
-    std::string aCircleError;
+    Events_InfoMessage aCircleError;
     bool aShapeValid = aShapeValidator->isValid(aRefAttr, anArguments, aCircleError);
     // the circle line is not a valid case
     if (aShapeValid) {
@@ -80,7 +82,7 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut
       
     anArguments.clear();
     anArguments.push_back("line");
-    std::string aLineError;
+    Events_InfoMessage aLineError;
     aShapeValid = aShapeValidator->isValid(aRefAttr, anArguments, aLineError);
     // if the attribute value is not a line, that means it is a vertex. A vertex is always valid
     if (aShapeValid) {
@@ -146,7 +148,7 @@ static bool hasCoincidentPoint(FeaturePtr theFeature1, FeaturePtr theFeature2)
 
 bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute, 
                                                 const std::list<std::string>& theArguments,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -217,7 +219,7 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute
 
 bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute,
                                              const std::list<std::string>& theArguments,
-                                             std::string& theError) const
+                                             Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -259,7 +261,7 @@ bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute,
 
 bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute, 
                                               const std::list<std::string>& theArguments,
-                                              std::string& theError) const
+                                              Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -314,7 +316,7 @@ bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute,
 
 bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute, 
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const
+                                               Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -343,7 +345,7 @@ bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute,
 
 bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttribute, 
                                                     const std::list<std::string>& theArguments,
-                                                    std::string& theError) const
+                                                    Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -402,7 +404,7 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri
 
 bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute, 
                                          const std::list<std::string>& theArguments,
-                                         std::string& theError) const
+                                         Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -442,7 +444,7 @@ bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
 
 bool SketchPlugin_SolverErrorValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                                 const std::list<std::string>& theArguments,
-                                                std::string& theError) const
+                                                Events_InfoMessage& theError) const
 {
   AttributeStringPtr aAttributeString = theFeature->string(SketchPlugin_Sketch::SOLVER_ERROR());
 
@@ -500,7 +502,7 @@ static bool hasSameTangentFeature(const std::set<AttributePtr>& theRefsList, con
 
 bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribute,
                                                  const std::list<std::string>& theArguments,
-                                                 std::string& theError) const
+                                                 Events_InfoMessage& theError) const
 {
   std::shared_ptr<SketchPlugin_ConstraintFillet> aFilletFeature = std::dynamic_pointer_cast<SketchPlugin_ConstraintFillet>(theAttribute->owner());
   AttributeRefAttrListPtr aPointsRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
@@ -673,7 +675,7 @@ bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribut
 
 bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttribute, 
                                                     const std::list<std::string>& theArguments,
-                                                    std::string& theError) const
+                                                    Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -719,7 +721,7 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttri
 
 bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttribute,
                                                     const std::list<std::string>& /*theArguments*/,
-                                                    std::string& theError) const
+                                                    Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -773,7 +775,7 @@ bool SketchPlugin_ArcTangentPointValidator::isValid(const AttributePtr& theAttri
 
 bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribute,
                                                  const std::list<std::string>& theArguments,
-                                                 std::string& theError) const
+                                                 Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
@@ -819,7 +821,7 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut
 
 bool SketchPlugin_ProjectionValidator::isValid(const AttributePtr& theAttribute,
                                                const std::list<std::string>& theArguments,
-                                               std::string& theError) const
+                                               Events_InfoMessage& theError) const
 {
   if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
index f201e1b3a0da5248a9a1099910e8be0b39e7f3c6..2ebb8ad76f0ee3a9e5548606b5629baa9adec827 100644 (file)
@@ -26,7 +26,7 @@ class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**\class SketchPlugin_TangentAttrValidator
@@ -44,7 +44,7 @@ class SketchPlugin_TangentAttrValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 
@@ -63,7 +63,7 @@ class SketchPlugin_NotFixedValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**\class SketchPlugin_EqualAttrValidator
@@ -81,7 +81,7 @@ class SketchPlugin_EqualAttrValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**\class SketchPlugin_MirrorAttrValidator
@@ -99,7 +99,7 @@ class SketchPlugin_MirrorAttrValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 
@@ -118,7 +118,7 @@ class SketchPlugin_CoincidenceAttrValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 
@@ -138,7 +138,7 @@ class SketchPlugin_CopyValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**\class SketchPlugin_SolverErrorValidator
@@ -156,7 +156,7 @@ class SketchPlugin_SolverErrorValidator : public ModelAPI_FeatureValidator
   //! \param theError error message
   virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 
   /// Returns true if the attribute in feature is not obligatory for the feature execution
   virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
@@ -177,7 +177,7 @@ public:
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 
@@ -196,7 +196,7 @@ class SketchPlugin_MiddlePointAttrValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 
@@ -215,7 +215,7 @@ class SketchPlugin_ArcTangentPointValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**\class SketchPlugin_IntersectionValidator
@@ -231,7 +231,7 @@ class SketchPlugin_IntersectionValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 /**\class SketchPlugin_ProjectionValidator
@@ -247,7 +247,7 @@ class SketchPlugin_ProjectionValidator : public ModelAPI_AttributeValidator
   //! \param theError error message
   virtual bool isValid(const AttributePtr& theAttribute,
                        const std::list<std::string>& theArguments,
-                       std::string& theError) const;
+                       Events_InfoMessage& theError) const;
 };
 
 #endif
index 04a3f5316c2f71e50b5e30cca4fc9f679d5a70d9..511d1f578efdfa131d81cb16bfc24098b6ce344c 100644 (file)
@@ -60,7 +60,7 @@ void XGUI_ErrorDialog::clear()
 
 void XGUI_ErrorDialog::addError(std::shared_ptr<Events_InfoMessage> theMsg)
 {
-  std::string aError = Config_Translator::translate(theMsg);
+  std::string aError = Config_Translator::translate(*theMsg);
   std::string aCodec = Config_Translator::codec(theMsg->context());
   QString aMsg = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aError.c_str());
   myErrors.append(aMsg);