Salome HOME
add method NameChanged to update title name
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeStudyProperties.cxx
index ce9193631f86600cf2ed6a9e3017d0b587a4a145..6b9c59d089fdc37de3d5fcbbd608afff3cf0a3a5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,6 +26,7 @@
 //
 #include "SALOMEDSImpl_AttributeStudyProperties.hxx"
 #include <string.h>
+#include <stdlib.h>
 
 const std::string& SALOMEDSImpl_AttributeStudyProperties::GetID()
 {
@@ -48,6 +49,7 @@ SALOMEDSImpl_AttributeStudyProperties::SALOMEDSImpl_AttributeStudyProperties()
 {
   myLocked = false;
   myLockChanged = false;
+  myModified = false;
   Init();
 }
 
@@ -64,11 +66,11 @@ void SALOMEDSImpl_AttributeStudyProperties::Init()
 }
 
 void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName,
-                                                            const int            theMinute,
-                                                            const int            theHour,
-                                                            const int            theDay,
-                                                            const int            theMonth,
-                                                            const int            theYear)
+                                                            const int          theMinute,
+                                                            const int          theHour,
+                                                            const int          theDay,
+                                                            const int          theMonth,
+                                                            const int          theYear)
 {
   if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 ||
       theDay<0 || theDay>31 || theMonth<0 || theMonth>12)
@@ -309,7 +311,7 @@ std::string SALOMEDSImpl_AttributeStudyProperties::Save()
   for ( versionsIt = versions.begin(); versionsIt != versions.end(); ++versionsIt ) {
     sprintf(&(aProperty[a]),"%s=%s",
             (char*)(versionsIt->first.c_str()),
-           (char*)(versionsIt->second.c_str()));
+            (char*)(versionsIt->second.c_str()));
     a = strlen(aProperty);
     aProperty[a++] = 1;
   }
@@ -488,26 +490,26 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value)
       for(verSize = 0; aCopy[anIndex+modSize+1+verSize] != 1; verSize++);
 
       if(modSize > 0) {
-       char *aModule = new char[modSize+1];
-       strncpy(aModule, &(aCopy[anIndex]), modSize);
-       aModule[modSize] = 0;
-       char *aVersions = new char[verSize+1];
-       if ( verSize > 0 )
-         strncpy(aVersions, &(aCopy[anIndex+modSize+1]), verSize);
-       aVersions[verSize] = 0;
-       
-       std::string mVersions = aVersions;
-       int start = 0, idx = mVersions.find( ';', start );
-       while ( idx != std::string::npos ) {
-         SetComponentVersion( aModule, mVersions.substr( start, idx-start ) );
-         start = idx + 1;
-         idx = mVersions.find( ';', start );
-       }
-       SetComponentVersion( aModule, mVersions.substr( start ) );
-
-       delete [] (aModule);
-       delete [] (aVersions);
-       anIndex += modSize + 1 + verSize + 1;
+        char *aModule = new char[modSize+1];
+        strncpy(aModule, &(aCopy[anIndex]), modSize);
+        aModule[modSize] = 0;
+        char *aVersions = new char[verSize+1];
+        if ( verSize > 0 )
+          strncpy(aVersions, &(aCopy[anIndex+modSize+1]), verSize);
+        aVersions[verSize] = 0;
+        
+        std::string mVersions = aVersions;
+        int start = 0, idx = mVersions.find( ';', start );
+        while ( idx != std::string::npos ) {
+          SetComponentVersion( aModule, mVersions.substr( start, idx-start ) );
+          start = idx + 1;
+          idx = mVersions.find( ';', start );
+        }
+        SetComponentVersion( aModule, mVersions.substr( start ) );
+
+        delete [] (aModule);
+        delete [] (aVersions);
+        anIndex += modSize + 1 + verSize + 1;
       }
     }
   }