Salome HOME
Correctly manage the invalid expressions
[modules/shaper.git] / src / Model / Model_AttributeDouble.cpp
index 29ca7be4e70d4b9bfcc6dae4a98dd792b91be369..c65748dee83f50d4273fd6ccab3b29a8b199487e 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
+#include <TDataStd_UAttribute.hxx>
 
 using namespace std;
 
@@ -52,3 +53,19 @@ string Model_AttributeDouble::text()
 {
   return TCollection_AsciiString(myText->Get()).ToCString();
 }
+
+Standard_GUID kInvalidGUID("caee5ce4-34b1-4b29-abcb-685287d18096");
+
+void Model_AttributeDouble::setExpressionInvalid(const bool theFlag)
+{
+  if (theFlag) {
+    TDataStd_UAttribute::Set(myReal->Label(), kInvalidGUID);
+  } else {
+    myReal->Label().ForgetAttribute(kInvalidGUID);
+  }
+}
+
+bool Model_AttributeDouble::expressionInvalid()
+{
+  return myReal->Label().IsAttribute(kInvalidGUID);
+}